Private
Public Access
1
0

some more tests for Polar stuff

This commit is contained in:
Sander Roosendaal
2022-01-19 20:11:07 +01:00
parent fbbe04b928
commit f9dbdfefca
4 changed files with 69 additions and 8 deletions

View File

@@ -1021,6 +1021,7 @@ def mocked_requests(*args, **kwargs):
polartester = re.compile(r'.*?polaraccesslink\.com')
polarremotetester = re.compile(r'.*?polarremote\.com')
c2tester = re.compile(r'.*?log\.concept2\.com')
stravatester = re.compile(r'.*?strava\.com')
sttester = re.compile(r'.*?sporttracks\.mobi')
@@ -1041,6 +1042,9 @@ def mocked_requests(*args, **kwargs):
polartcxregex = r'.*?polaraccesslink\.com\/.*\/(\d+)\/tcx'
polartcxtester = re.compile(polartcxregex)
polarnotificationregex = r'.*polaraccesslink\.com\/.*\/notifications'
polarnotificationtester = re.compile(polarnotificationregex)
c2importregex = r'.*?concept2.com\/api\/users\/me\/results\/\d+'
c2importtester = re.compile(c2importregex)
@@ -1134,8 +1138,32 @@ def mocked_requests(*args, **kwargs):
json_data = stravaathletejson
return MockResponse(json_data,200)
if polarremotetester.match(args[0]):
json_data = {
'access_token':'aap',
'expires_in':31535999,
'x_user_id':1,
}
return MockResponse(json_data,200)
if polartester.match(args[0]):
if polartcxtester.match(args[0]):
if polarnotificationtester.match(args[0]):
json_data = {
"available-user-data": [
{
"user-id": 475,
"data-type": "ACTIVITY_SUMMARY",
"url": "https://www.polaraccesslink.com/v3/users/475/activity-transactions"
},
{
'user-id': 475,
'data-type': 'EXERCISE',
'url': 'https://polaraccesslink.com/v3/users/40273947/exercise-transactions'
}
]
}
return MockResponse(json_data,200)
elif polartcxtester.match(args[0]):
filename = 'rowers/tests/testdata/polar_response.tcx'
return MockContentResponse(filename,200)
elif polarexercisetester.match(args[0]):