more coverage related
This commit is contained in:
@@ -817,7 +817,7 @@ def mocked_requests(*args, **kwargs):
|
||||
self.status_code = status_code
|
||||
self.ok = True
|
||||
|
||||
class MockOAuth1Session():
|
||||
class MockOAuth1Session:
|
||||
def __init__(self,*args, **kwargs):
|
||||
pass
|
||||
|
||||
@@ -851,18 +851,46 @@ def mocked_requests(*args, **kwargs):
|
||||
|
||||
return MockResponse(json_data,200)
|
||||
|
||||
|
||||
if 'garmin' in args:
|
||||
return MockOAuth1Session()
|
||||
|
||||
if 'url' in kwargs:
|
||||
if 'rp3' in kwargs['url']:
|
||||
args = [kwargs['url']]
|
||||
if "tofit" in kwargs['url']:
|
||||
args = [kwargs['url']]
|
||||
|
||||
if not args:
|
||||
return MockSession()
|
||||
|
||||
|
||||
if "tofit" in args[0]:
|
||||
jsonresponse = {
|
||||
'name': '',
|
||||
'sport': 'rowing',
|
||||
'filename': '/home/sander/python/rowsandall/media/630a9e78-6d34-4eb3-8d53-4c02b2e95fff.fit',
|
||||
'steps': [
|
||||
{
|
||||
'wkt_step_name': '0',
|
||||
'stepId': 0,
|
||||
'durationType': 'Distance',
|
||||
'durationValue': 100000,
|
||||
'intensity': 'Active'
|
||||
},
|
||||
{
|
||||
'wkt_step_name': '1',
|
||||
'stepId': 1,
|
||||
'durationType': 'RepeatUntilStepsCmplt',
|
||||
'targetValue': 4,
|
||||
'durationValue': 0
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
return MockResponse(jsonresponse,200)
|
||||
|
||||
|
||||
polartester = re.compile('.*?polaraccesslink\.com')
|
||||
c2tester = re.compile('.*?log\.concept2\.com')
|
||||
stravatester = re.compile('.*?strava\.com')
|
||||
@@ -1171,3 +1199,22 @@ class MockEmailMessage:
|
||||
|
||||
def send(self):
|
||||
return 1
|
||||
|
||||
class MockResponse:
|
||||
def __init__(self, json_data, status_code):
|
||||
self.json_data = json_data
|
||||
self.status_code = status_code
|
||||
self.ok = True
|
||||
|
||||
def json(self):
|
||||
return self.json_data
|
||||
|
||||
class MockOAuth1Session:
|
||||
def __init__(self,*args, **kwargs):
|
||||
pass
|
||||
|
||||
def get(*args,**kwargs):
|
||||
return MockStreamResponse('rowers/tests/testdata/3x250m.fit',200)
|
||||
|
||||
def post(*args, **kwargs):
|
||||
return MockResponse({},200)
|
||||
|
||||
Reference in New Issue
Block a user