Private
Public Access
1
0

expanding landing pages and adding a test for different workout types in listview

This commit is contained in:
Sander Roosendaal
2021-12-31 09:09:43 +01:00
parent 3bd9bc9a66
commit d77a67ac39
4 changed files with 65 additions and 6 deletions

View File

@@ -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',

View File

@@ -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):

Binary file not shown.

View File

@@ -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')
)