Private
Public Access
1
0

fixing mock session

This commit is contained in:
Sander Roosendaal
2021-01-15 08:15:35 +01:00
parent 8ebb55cfd7
commit 264e7132dd
2 changed files with 12 additions and 1 deletions

View File

@@ -657,6 +657,16 @@ def mocked_requests(*args, **kwargs):
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):
# prepped.url
# prepped.body (post data)

View File

@@ -117,7 +117,8 @@ class GarminObjects(DjangoTestCase):
self.assertEqual(response.status_code,200)
@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_secret = 'noot'
garmintoken = 'mies'