Private
Public Access
1
0

gets strava owner id thru api

This commit is contained in:
Sander Roosendaal
2020-07-12 10:11:52 +02:00
parent 224ae2faa5
commit 5e023a0e07
4 changed files with 37 additions and 0 deletions

View File

@@ -606,6 +606,8 @@ def mocked_requests(*args, **kwargs):
uastrokesjson = json.load(open('rowers/tests/testdata/uastrokes.txt','r'))
uauserjson = json.load(open('rowers/tests/testdata/uauser.txt','r'))
stravaathletejson = json.load(open('rowers/tests/testdata/strava_athlete.txt'))
class MockResponse:
def __init__(self, json_data, status_code):
self.json_data = json_data
@@ -660,6 +662,10 @@ def mocked_requests(*args, **kwargs):
c2workoutlistregex = '.*?concept2\.com\/api\/users\/me\/results\?page=\d'
c2workoutlisttester = re.compile(c2workoutlistregex)
stravaathleteregex = '.*?strava\.com\/api\/v3\/athlete$'
stravaathletetester = re.compile(stravaathleteregex)
stravaworkoutlistregex = '.*?strava\.com\/api\/v3\/athlete\/activities'
stravaworkoutlisttester = re.compile(stravaworkoutlistregex)
@@ -703,6 +709,10 @@ def mocked_requests(*args, **kwargs):
tpuploadregex = '.*?trainingpeaks\.com\/v1\/file'
tpuploadtester = re.compile(tpuploadregex)
if stravaathletetester.match(args[0]):
json_data = stravaathletejson
return MockResponse(json_data,200)
if polartester.match(args[0]):
json_data = polar_json
return MockResponse(json_data,200)

View File

@@ -0,0 +1 @@
{"id": 47155909, "username": null, "resource_state": 2, "firstname": "Rowsandall", "lastname": "Testing", "city": "Zliv", "state": "Jiho\u010desk\u00fd kraj", "country": "Czechia", "sex": "M", "premium": false, "summit": false, "created_at": "2019-10-06T06:59:54Z", "updated_at": "2020-05-15T11:52:33Z", "badge_type_id": 0, "profile_medium": "avatar/athlete/medium.png", "profile": "avatar/athlete/large.png", "friend": null, "follower": null}