at least passing part
This commit is contained in:
@@ -1876,10 +1876,118 @@ class PlannedSessionsView(TestCase):
|
|||||||
response = self.c.post(url,follow=True)
|
response = self.c.post(url,follow=True)
|
||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
def test_instantplan_vie(self):
|
# next test should mock training plan server
|
||||||
|
|
||||||
|
def test_instantplan_view(self):
|
||||||
|
self.u.is_staff = True
|
||||||
|
self.u.save()
|
||||||
login = self.c.login(username=self.u.username, password=self.password)
|
login = self.c.login(username=self.u.username, password=self.password)
|
||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
|
|
||||||
url = reverse('rower_select_instantplan')
|
url = reverse('rower_select_instantplan')
|
||||||
response = self.c.get(url)
|
response = self.c.get(url)
|
||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
# add a plan
|
||||||
|
url = reverse('add_instantplan_view')
|
||||||
|
response = self.c.get(url)
|
||||||
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
form_data = {
|
||||||
|
'name': 'Test Plan',
|
||||||
|
'price': 0,
|
||||||
|
'url':'https://nos.nl',
|
||||||
|
'goal':'hard roeien',
|
||||||
|
'description':'win everything with this plan',
|
||||||
|
'duration':28,
|
||||||
|
'target':'race faster',
|
||||||
|
'hoursperweek':4,
|
||||||
|
'sessionsperweek':4,
|
||||||
|
#'yaml': {'yaml': SimpleUploadedFile('britishrowing.yml', f.read())}
|
||||||
|
}
|
||||||
|
|
||||||
|
s = b"""filename: britishrowing.json
|
||||||
|
name: British Rowing Training Plan Beginner Week 1
|
||||||
|
trainingDays:
|
||||||
|
- order: 1
|
||||||
|
workouts:
|
||||||
|
- workoutName: Week 1 Session 1
|
||||||
|
steps:
|
||||||
|
- stepId: 0
|
||||||
|
wkt_step_name: Warmup
|
||||||
|
durationType: Time
|
||||||
|
durationValue: 300000
|
||||||
|
intensity: Warmup
|
||||||
|
description: ""
|
||||||
|
- stepId: 1
|
||||||
|
wkt_step_name: Intervals
|
||||||
|
durationType: Time
|
||||||
|
durationValue: 60000
|
||||||
|
intensity: Active
|
||||||
|
description: ""
|
||||||
|
- stepId: 2
|
||||||
|
wkt_step_name: Interval Rest
|
||||||
|
durationType: Time
|
||||||
|
durationValue: 60000
|
||||||
|
intensity: Rest
|
||||||
|
description: ""
|
||||||
|
- stepId: 3
|
||||||
|
wkt_step_name: Rep
|
||||||
|
durationType: RepeatUntilStepsCmplt
|
||||||
|
durationValue: 1
|
||||||
|
targetValue: 5
|
||||||
|
- stepId: 4
|
||||||
|
wkt_step_name: Cooldown
|
||||||
|
durationType: Time
|
||||||
|
durationValue: 300000
|
||||||
|
intensity: Cooldown
|
||||||
|
description: ""
|
||||||
|
sport: ""
|
||||||
|
description: ""
|
||||||
|
- order: 4
|
||||||
|
workouts:
|
||||||
|
- workoutName: Week 1 Session 2
|
||||||
|
steps:
|
||||||
|
- stepId: 0
|
||||||
|
wkt_step_name: Warmup
|
||||||
|
durationType: Time
|
||||||
|
durationValue: 300000
|
||||||
|
intensity: Warmup
|
||||||
|
description: ""
|
||||||
|
- stepId: 1
|
||||||
|
wkt_step_name: Interval
|
||||||
|
durationType: Time
|
||||||
|
durationValue: 300000
|
||||||
|
intensity: Active
|
||||||
|
description: ""
|
||||||
|
- stepId: 2
|
||||||
|
wkt_step_name: Interval Rest
|
||||||
|
durationType: Time
|
||||||
|
durationValue: 180000
|
||||||
|
intensity: Rest
|
||||||
|
description: ""
|
||||||
|
- stepId: 3
|
||||||
|
wkt_step_name: Rep
|
||||||
|
durationType: RepeatUntilStepsCmplt
|
||||||
|
durationValue: 1
|
||||||
|
targetValue: 5
|
||||||
|
- stepId: 4
|
||||||
|
wkt_step_name: Cooldown
|
||||||
|
durationType: Time
|
||||||
|
durationValue: 300000
|
||||||
|
intensity: Cooldown
|
||||||
|
description: ""
|
||||||
|
sport: ""
|
||||||
|
description: ""
|
||||||
|
duration: 7
|
||||||
|
description: ""
|
||||||
|
"""
|
||||||
|
|
||||||
|
file_data = {'yaml': SimpleUploadedFile('britishrowing.yml', s)}
|
||||||
|
|
||||||
|
form = InstantPlanForm(form_data,file_data)
|
||||||
|
if not form.is_valid():
|
||||||
|
print(form.errors)
|
||||||
|
self.assertTrue(form.is_valid())
|
||||||
|
|||||||
Reference in New Issue
Block a user