adding a test
This commit is contained in:
@@ -390,13 +390,15 @@ class C2Integration(SyncIntegration):
|
||||
|
||||
# this part to get_workout_list
|
||||
workouts = self.get_workout_list(page=page)
|
||||
count = 0
|
||||
|
||||
for workout in workouts:
|
||||
c2id = workout['id']
|
||||
if workout['new'] == 'NEW':
|
||||
self.get_workout(c2id)
|
||||
count+= 1
|
||||
|
||||
return 1
|
||||
return count
|
||||
|
||||
# should be unified to workout list
|
||||
def get_workout_list(self, *args, **kwargs):
|
||||
|
||||
@@ -75,14 +75,16 @@ class NKIntegration(SyncIntegration):
|
||||
return 0
|
||||
|
||||
workouts = self.get_workout_list(before=before, after=after)
|
||||
|
||||
count = 0
|
||||
|
||||
for workout in workouts:
|
||||
nkid = workout['id']
|
||||
if workout['new'] == 'NEW':
|
||||
dologging('nklog.log','Queueing {id}'.format(id=nkid))
|
||||
self.get_workout(nkid, before=before, after=after)
|
||||
count += 1
|
||||
|
||||
return 1
|
||||
return count
|
||||
|
||||
|
||||
def get_workout(self, id, *args, **kwargs) -> int:
|
||||
|
||||
@@ -346,12 +346,15 @@ class C2Objects(DjangoTestCase):
|
||||
@patch('rowers.integrations.c2.requests.get', side_effect=mocked_requests)
|
||||
@patch('rowers.integrations.c2.requests.session', side_effect=mocked_requests)
|
||||
def test_c2_auto_import(self, mock_get, mock_post,MockSession):
|
||||
self.r.sporttracks_auto_export = True
|
||||
self.r.c2_auto_export = True
|
||||
self.r.save()
|
||||
c2integration = C2Integration(self.u)
|
||||
res = c2integration.get_workouts()
|
||||
|
||||
self.assertEqual(res,1)
|
||||
self.assertEqual(res,50)
|
||||
|
||||
res = c2integration.get_workouts()
|
||||
self.assertEqual(res,0)
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user