diff --git a/rowers/mytypes.py b/rowers/mytypes.py index e264fa8c..fc249da2 100644 --- a/rowers/mytypes.py +++ b/rowers/mytypes.py @@ -61,12 +61,12 @@ workouttypes_icons = collections.OrderedDict({ 'Hike':'hike.svg', # ok 'Walk':'walk.svg', # o k 'Canoeing':'canoeing.svg', # ok - 'Crossfit':'crossfit.svg', - 'StandUpPaddling':'standup_paddling.svg', - 'IceSkate':'ice_skating.svg', - 'WeightTraining':'weight_training.svg', + 'Crossfit':'crossfit.svg', # ok + 'StandUpPaddling':'standup_paddling.svg', # ok + 'IceSkate':'ice_skating.svg', # ok + 'WeightTraining':'weight_training.svg', # ok 'InlineSkate':'inline_skating.svg', - 'Kayaking':'kayaking.svg', + 'Kayaking':'kayaking.svg', # ok 'Workout':'workout.svg', 'Yoga':'yoga.svg', # 'bike':'Bike', diff --git a/rowers/tests/test_aworkouts.py b/rowers/tests/test_aworkouts.py index b9f6f85f..db8c24f1 100644 --- a/rowers/tests/test_aworkouts.py +++ b/rowers/tests/test_aworkouts.py @@ -14,7 +14,7 @@ from io import BytesIO from PIL import Image from io import StringIO - +from rowers.mytypes import workouttypes def create_image(storage, filename, size=(100, 100), image_mode='RGB', image_format='PNG'): """ @@ -31,6 +31,63 @@ def create_image(storage, filename, size=(100, 100), image_mode='RGB', image_for image_file = ContentFile(data.read()) return storage.save(filename, image_file) +class ListWorkoutTest(TestCase): + def setUp(self): + self.u = UserFactory() + + self.r = Rower.objects.create(user=self.u, + birthdate=faker.profile()['birthdate'], + gdproptin=True,surveydone=True, + gdproptindate=timezone.now(), + rowerplan='coach') + + self.c = Client() + self.user_workouts = WorkoutFactory.create_batch(len(workouttypes), user=self.r) + i = 0 + for workouttype in workouttypes: + self.user_workouts[i].workouttype = workouttype[0] + self.user_workouts[i].save() + i = i+1 + + self.factory = RequestFactory() + self.password = faker.word() + self.u.set_password(self.password) + self.u.save() + + def tearDown(self): + for workout in self.user_workouts: + try: + os.remove(workout.csvfilename) + except (IOError, FileNotFoundError,OSError): + pass + + @patch('rowers.dataprep.create_engine') + @patch('rowers.dataprep.getsmallrowdata_db') + @patch('rowers.dataprep.myqueue') + def test_list_workouts(self, mocked_sqlalchemy, + mocked_getsmallrowdata_db, + mocked_myqueue): + + login = self.c.login(username=self.u.username, password=self.password) + self.assertTrue(login) + + + + url = reverse('workouts_view') + + response = self.c.get(url) + self.assertEqual(response.status_code,200) + + url2 = url+'?page=2' + + response = self.c.get(url2) + self.assertEqual(response.status_code,200) + + url3 = url+'?page=3' + + response = self.c.get(url3) + self.assertEqual(response.status_code,200) + @override_settings(TESTING=True) class WorkoutViewTest(TestCase): def setUp(self): diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz deleted file mode 100644 index a0e60e63..00000000 Binary files a/rowers/tests/testdata/testdata.tcx.gz and /dev/null differ diff --git a/rowers/utils.py b/rowers/utils.py index cb198fb7..596fc4ff 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -42,6 +42,8 @@ landingpages = ( ('workout_stats_view','Stats View'), ('workout_data_view','Data Explore View'), ('workout_summary_edit_view','Intervals Editor'), + ('workout_flexchart_stacked_view','Workout Stacked Chart'), + ('workout_flexchart3_view','Workout Flex Chart') )