Private
Public Access
1
0

next step polar

This commit is contained in:
Sander Roosendaal
2022-01-21 15:41:00 +01:00
parent f9dbdfefca
commit ae6e2f55b0
5 changed files with 131 additions and 45 deletions

View File

@@ -768,6 +768,25 @@ def mocked_requests(*args, **kwargs):
]
}
polar_user_data = {
"polar-user-id": 475,
"member-id": "i09u9ujj",
"registration-date": "2011-10-14T12:50:37.000Z",
"first-name": "Eka",
"last-name": "Toka",
"birthdate": "1985-09-06",
"gender": "MALE",
"weight": 66,
"height": 170,
"field": [
{
"value": "2",
"index": 0,
"name": "number-of-children"
}
]
}
polar_exercise_dict = {
"id": 1937529874,
"upload-time": "2008-10-13T10:40:02Z",
@@ -1042,6 +1061,9 @@ def mocked_requests(*args, **kwargs):
polartcxregex = r'.*?polaraccesslink\.com\/.*\/(\d+)\/tcx'
polartcxtester = re.compile(polartcxregex)
polaruserregex = r'.*?polaraccesslink\.com\/.*\/users$'
polarusertester = re.compile(polaruserregex)
polarnotificationregex = r'.*polaraccesslink\.com\/.*\/notifications'
polarnotificationtester = re.compile(polarnotificationregex)
@@ -1142,7 +1164,7 @@ def mocked_requests(*args, **kwargs):
json_data = {
'access_token':'aap',
'expires_in':31535999,
'x_user_id':1,
'x_user_id':475,
}
return MockResponse(json_data,200)
@@ -1163,6 +1185,9 @@ def mocked_requests(*args, **kwargs):
]
}
return MockResponse(json_data,200)
elif polarusertester.match(args[0]):
json_data = polar_user_data
return MockResponse(json_data,200)
elif polartcxtester.match(args[0]):
filename = 'rowers/tests/testdata/polar_response.tcx'
return MockContentResponse(filename,200)