passing tests with mock server for nk workouts list
This commit is contained in:
@@ -621,6 +621,8 @@ def mocked_requests(*args, **kwargs):
|
||||
stravaworkoutlist = json.load(open('rowers/tests/testdata/stravaworkoutlist.txt'))
|
||||
sporttracksworkoutlist = json.load(open('rowers/tests/testdata/sporttracksworkouts.txt'))
|
||||
|
||||
nkworkoutlist = json.load(open('rowers/tests/testdata/nkworkouts.txt'))
|
||||
|
||||
rkworkoutlistjson = json.load(open('rowers/tests/testdata/rkworkoutslist.txt','r'))
|
||||
uaworkoutlistjson = json.load(open('rowers/tests/testdata/uaworkoutlist.txt','r'))
|
||||
|
||||
@@ -732,6 +734,7 @@ def mocked_requests(*args, **kwargs):
|
||||
rktester = re.compile('.*?runkeeper\.com')
|
||||
uatester = re.compile('.*?mapmyfitness\.com')
|
||||
tptester = re.compile('.*?trainingpeaks\.com')
|
||||
nktester = re.compile('.*?nkrowlink\.com')
|
||||
garmintester = re.compile('.*?garmin\.com')
|
||||
|
||||
c2importregex = '.*?concept2.com\/api\/users\/me\/results\/\d+'
|
||||
@@ -746,6 +749,9 @@ def mocked_requests(*args, **kwargs):
|
||||
c2workoutlistregex = '.*?concept2\.com\/api\/users\/me\/results\?page=\d'
|
||||
c2workoutlisttester = re.compile(c2workoutlistregex)
|
||||
|
||||
nkworkoutlistregex = '.*?nkrowlink\.com\/api\/v1\/sessions'
|
||||
nkworkoutlisttester = re.compile(nkworkoutlistregex)
|
||||
|
||||
stravaathleteregex = '.*?strava\.com\/api\/v3\/athlete$'
|
||||
stravaathletetester = re.compile(stravaathleteregex)
|
||||
|
||||
@@ -796,6 +802,7 @@ def mocked_requests(*args, **kwargs):
|
||||
garmindownloadregex = '.*?garmin\.com\/mockfile?id=1'
|
||||
garmindownloadtester = re.compile(garmindownloadregex)
|
||||
|
||||
|
||||
if garmintester.match(args[0]):
|
||||
if garmindownloadtester.match(args[0]):
|
||||
return MockStreamResponse('rowers/tests/testdata/3x250m.fit',200)
|
||||
@@ -910,6 +917,20 @@ def mocked_requests(*args, **kwargs):
|
||||
return MockResponse(sporttracksworkoutlist,200)
|
||||
|
||||
|
||||
if nktester.match(args[0]):
|
||||
if nkworkoutlisttester.match(args[0]):
|
||||
return MockResponse(nkworkoutlist,200)
|
||||
elif 'token' in args[0]:
|
||||
json_data = {
|
||||
"token_type": "Bearer",
|
||||
"access_token": "987654321234567898765432123456789",
|
||||
"refresh_token": "1234567898765432112345678987654321",
|
||||
"expires_at": arrow.now().timestamp()+7200
|
||||
}
|
||||
|
||||
return MockResponse(json_data,200)
|
||||
|
||||
|
||||
if stravatester.match(args[0]):
|
||||
if stravaworkoutlisttester.match(args[0]):
|
||||
return MockResponse(stravaworkoutlist,200)
|
||||
|
||||
Reference in New Issue
Block a user