fixing mock session
This commit is contained in:
@@ -657,6 +657,16 @@ def mocked_requests(*args, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
class MockSession:
|
class MockSession:
|
||||||
|
class headers:
|
||||||
|
def __init__(self,*args,**kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update(self,*args,**kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def post(self, *args, **kwargs):
|
||||||
|
return MockResponse('',200)
|
||||||
|
|
||||||
def send(self,prepped):
|
def send(self,prepped):
|
||||||
# prepped.url
|
# prepped.url
|
||||||
# prepped.body (post data)
|
# prepped.body (post data)
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ class GarminObjects(DjangoTestCase):
|
|||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
@patch('rowers.tasks.OAuth1Session',side_effect=mocked_requests)
|
@patch('rowers.tasks.OAuth1Session',side_effect=mocked_requests)
|
||||||
def test_handle_get_garmin_file(self, MockOAuth1Session):
|
@patch('rowers.tasks.requests.session', side_effect=mocked_requests)
|
||||||
|
def test_handle_get_garmin_file(self, MockSession, MockOAuth1Session):
|
||||||
client_id = 'garmin'
|
client_id = 'garmin'
|
||||||
client_secret = 'noot'
|
client_secret = 'noot'
|
||||||
garmintoken = 'mies'
|
garmintoken = 'mies'
|
||||||
|
|||||||
Reference in New Issue
Block a user