committing survey
This commit is contained in:
@@ -23,7 +23,7 @@ class PermissionsFreeCoach(TestCase):
|
||||
self.ufreecoach = UserFactory(username='coachuser')
|
||||
self.rfreecoach = Rower.objects.create(user=self.ufreecoach,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='freecoach',clubsize=100)
|
||||
|
||||
self.coachinggroup = CoachingGroup.objects.create()
|
||||
@@ -33,11 +33,11 @@ class PermissionsFreeCoach(TestCase):
|
||||
self.password = faker.word()
|
||||
self.ufreecoach.set_password(self.password)
|
||||
self.ufreecoach.save()
|
||||
|
||||
|
||||
self.uplan = UserFactory(username='planuser')
|
||||
self.rplan = Rower.objects.create(user=self.uplan,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='plan')
|
||||
|
||||
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
|
||||
@@ -45,11 +45,11 @@ class PermissionsFreeCoach(TestCase):
|
||||
self.password = faker.word()
|
||||
self.uplan.set_password(self.password)
|
||||
self.uplan.save()
|
||||
|
||||
|
||||
self.upro = UserFactory(username='prouser')
|
||||
self.rpro = Rower.objects.create(user=self.upro,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='pro')
|
||||
|
||||
self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
|
||||
@@ -61,7 +61,7 @@ class PermissionsFreeCoach(TestCase):
|
||||
self.uplan2 = UserFactory(username='planuser2')
|
||||
self.rplan2 = Rower.objects.create(user=self.uplan2,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='plan')
|
||||
|
||||
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
|
||||
@@ -69,11 +69,11 @@ class PermissionsFreeCoach(TestCase):
|
||||
self.password = faker.word()
|
||||
self.uplan2.set_password(self.password)
|
||||
self.uplan2.save()
|
||||
|
||||
|
||||
self.upro2 = UserFactory(username='prouser2')
|
||||
self.rpro2 = Rower.objects.create(user=self.upro2,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='pro')
|
||||
|
||||
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
|
||||
@@ -85,7 +85,7 @@ class PermissionsFreeCoach(TestCase):
|
||||
self.ubasic = UserFactory(username='basicuser')
|
||||
self.rbasic = Rower.objects.create(user=self.ubasic,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='basic')
|
||||
|
||||
self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
|
||||
@@ -93,9 +93,9 @@ class PermissionsFreeCoach(TestCase):
|
||||
self.ubasicpassword = faker.word()
|
||||
self.ubasic.set_password(self.ubasicpassword)
|
||||
self.ubasic.save()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## TeamFreeCoach
|
||||
|
||||
self.teamfreecoach = Team.objects.create(
|
||||
@@ -120,8 +120,8 @@ class PermissionsFreeCoach(TestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(team2.manager,self.ufreecoach)
|
||||
|
||||
|
||||
|
||||
|
||||
team3 = Team.objects.create(
|
||||
name = 'ThirdTeam',
|
||||
notes = faker.text(),
|
||||
@@ -129,9 +129,9 @@ class PermissionsFreeCoach(TestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(team3.manager,self.ufreecoach)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Free coach can create more than one group
|
||||
def test_plan_groupmanager(self):
|
||||
team1 = Team.objects.create(
|
||||
@@ -147,11 +147,11 @@ class PermissionsFreeCoach(TestCase):
|
||||
notes = faker.text(),
|
||||
manager = self.ufreecoach,
|
||||
)
|
||||
|
||||
self.assertEqual(team2.manager,self.ufreecoach)
|
||||
|
||||
|
||||
|
||||
self.assertEqual(team2.manager,self.ufreecoach)
|
||||
|
||||
|
||||
|
||||
## Free Coach can create planned sessions and team planned sessions
|
||||
## Self Coach and higher can create planned sessions and team planned sessions
|
||||
def test_plan_create_session(self):
|
||||
@@ -161,7 +161,7 @@ class PermissionsFreeCoach(TestCase):
|
||||
comment=faker.text()
|
||||
)
|
||||
self.assertEqual(ps.manager,self.ufreecoach)
|
||||
|
||||
|
||||
def test_coach_create_session(self):
|
||||
ps = PlannedSession.objects.create(
|
||||
manager=self.ufreecoach,
|
||||
@@ -169,8 +169,8 @@ class PermissionsFreeCoach(TestCase):
|
||||
comment=faker.text()
|
||||
)
|
||||
self.assertEqual(ps.manager,self.ufreecoach)
|
||||
|
||||
|
||||
|
||||
|
||||
## Basic cannot join groups led by Free Coach
|
||||
def test_add_basic_pro_or_plan(self):
|
||||
with transaction.atomic():
|
||||
@@ -191,7 +191,7 @@ class PermissionsFreeCoach(TestCase):
|
||||
distance=result['totaldist'],
|
||||
workouttype = 'rower',
|
||||
)
|
||||
|
||||
|
||||
@override_settings(TESTING=True)
|
||||
class PermissionsBasicsTests(TestCase):
|
||||
def setUp(self):
|
||||
@@ -201,7 +201,7 @@ class PermissionsBasicsTests(TestCase):
|
||||
self.ucoach = UserFactory(username='coachuser')
|
||||
self.rcoach = Rower.objects.create(user=self.ucoach,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='coach',clubsize=10)
|
||||
|
||||
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
|
||||
@@ -212,11 +212,11 @@ class PermissionsBasicsTests(TestCase):
|
||||
self.password = faker.word()
|
||||
self.ucoach.set_password(self.password)
|
||||
self.ucoach.save()
|
||||
|
||||
|
||||
self.uplan = UserFactory(username='planuser')
|
||||
self.rplan = Rower.objects.create(user=self.uplan,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='plan')
|
||||
|
||||
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
|
||||
@@ -224,11 +224,11 @@ class PermissionsBasicsTests(TestCase):
|
||||
self.password = faker.word()
|
||||
self.uplan.set_password(self.password)
|
||||
self.uplan.save()
|
||||
|
||||
|
||||
self.upro = UserFactory(username='prouser')
|
||||
self.rpro = Rower.objects.create(user=self.upro,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='pro')
|
||||
|
||||
self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
|
||||
@@ -240,7 +240,7 @@ class PermissionsBasicsTests(TestCase):
|
||||
self.uplan2 = UserFactory(username='planuser2')
|
||||
self.rplan2 = Rower.objects.create(user=self.uplan2,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='plan')
|
||||
|
||||
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
|
||||
@@ -248,11 +248,11 @@ class PermissionsBasicsTests(TestCase):
|
||||
self.password = faker.word()
|
||||
self.uplan2.set_password(self.password)
|
||||
self.uplan2.save()
|
||||
|
||||
|
||||
self.upro2 = UserFactory(username='prouser2')
|
||||
self.rpro2 = Rower.objects.create(user=self.upro2,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='pro')
|
||||
|
||||
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
|
||||
@@ -264,7 +264,7 @@ class PermissionsBasicsTests(TestCase):
|
||||
self.ubasic = UserFactory(username='basicuser')
|
||||
self.rbasic = Rower.objects.create(user=self.ubasic,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='basic')
|
||||
|
||||
self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
|
||||
@@ -272,9 +272,9 @@ class PermissionsBasicsTests(TestCase):
|
||||
self.ubasicpassword = faker.word()
|
||||
self.ubasic.set_password(self.ubasicpassword)
|
||||
self.ubasic.save()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## TeamPro, TeamCoach, TeamSelfCoach
|
||||
|
||||
self.teampro = Team.objects.create(
|
||||
@@ -293,9 +293,9 @@ class PermissionsBasicsTests(TestCase):
|
||||
manager=self.ucoach)
|
||||
|
||||
# Requirements
|
||||
|
||||
|
||||
## Low level
|
||||
|
||||
|
||||
## Coach can have any number of groups
|
||||
def test_coach_groupmanager(self):
|
||||
team1 = Team.objects.create(
|
||||
@@ -313,8 +313,8 @@ class PermissionsBasicsTests(TestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(team2.manager,self.ucoach)
|
||||
|
||||
|
||||
|
||||
|
||||
team3 = Team.objects.create(
|
||||
name = 'ThirdTeam',
|
||||
notes = faker.text(),
|
||||
@@ -322,15 +322,15 @@ class PermissionsBasicsTests(TestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(team3.manager,self.ucoach)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Basic athletes can be member of Coach led group
|
||||
def test_add_coach(self):
|
||||
self.rbasic.team.add(self.teamcoach)
|
||||
self.assertIn(self.teamcoach,self.rbasic.team.all())
|
||||
|
||||
|
||||
|
||||
|
||||
## Self coach can create one group
|
||||
## Self coach cannot create more than one group
|
||||
def test_plan_groupmanager(self):
|
||||
@@ -348,9 +348,9 @@ class PermissionsBasicsTests(TestCase):
|
||||
notes = faker.text(),
|
||||
manager = self.uplan,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Pro users (and higher) can join group led by other Pro (or higher) user
|
||||
def test_add_proplan_pro_or_plan(self):
|
||||
self.rpro.team.add(self.teamplan)
|
||||
@@ -371,9 +371,9 @@ class PermissionsBasicsTests(TestCase):
|
||||
self.rcoach.team.add(self.teampro)
|
||||
self.assertIn(self.teampro,self.rcoach.team.all())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Coach can create planned sessions and team planned sessions
|
||||
## Self Coach and higher can create planned sessions and team planned sessions
|
||||
def test_plan_create_session(self):
|
||||
@@ -383,7 +383,7 @@ class PermissionsBasicsTests(TestCase):
|
||||
comment=faker.text()
|
||||
)
|
||||
self.assertEqual(ps.manager,self.uplan)
|
||||
|
||||
|
||||
def test_coach_create_session(self):
|
||||
ps = PlannedSession.objects.create(
|
||||
manager=self.ucoach,
|
||||
@@ -391,7 +391,7 @@ class PermissionsBasicsTests(TestCase):
|
||||
comment=faker.text()
|
||||
)
|
||||
self.assertEqual(ps.manager,self.ucoach)
|
||||
|
||||
|
||||
## Pro can have one group
|
||||
## Pro cannot create more than one group
|
||||
def test_pro_groupmanager(self):
|
||||
@@ -409,8 +409,8 @@ class PermissionsBasicsTests(TestCase):
|
||||
notes = faker.text(),
|
||||
manager = self.upro,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
## Pro or Basic cannot create planned sessions or team planned sessions
|
||||
def test_pro_create_plannedsession(self):
|
||||
with self.assertRaises(ValidationError):
|
||||
@@ -419,7 +419,7 @@ class PermissionsBasicsTests(TestCase):
|
||||
name = faker.word(),
|
||||
comment = faker.text()
|
||||
)
|
||||
|
||||
|
||||
def test_basic_create_plannedsession(self):
|
||||
with self.assertRaises(ValidationError):
|
||||
ps = PlannedSession.objects.create(
|
||||
@@ -427,7 +427,7 @@ class PermissionsBasicsTests(TestCase):
|
||||
name = faker.word(),
|
||||
comment = faker.text()
|
||||
)
|
||||
|
||||
|
||||
## Basic cannot join groups led by Pro or Self Coach
|
||||
def test_add_basic_pro_or_plan(self):
|
||||
with transaction.atomic():
|
||||
@@ -437,7 +437,7 @@ class PermissionsBasicsTests(TestCase):
|
||||
with transaction.atomic():
|
||||
with self.assertRaises(ValidationError):
|
||||
self.rbasic.team.add(self.teampro)
|
||||
|
||||
|
||||
|
||||
## Basic cannot manage a group
|
||||
def test_basic_groupmanager(self):
|
||||
@@ -461,7 +461,7 @@ class PermissionsViewTests(TestCase):
|
||||
self.ucoach = UserFactory(username='coachuser')
|
||||
self.rcoach = Rower.objects.create(user=self.ucoach,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='coach',clubsize=10)
|
||||
|
||||
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
|
||||
@@ -472,11 +472,11 @@ class PermissionsViewTests(TestCase):
|
||||
self.ucoachpassword = faker.word()
|
||||
self.ucoach.set_password(self.ucoachpassword)
|
||||
self.ucoach.save()
|
||||
|
||||
|
||||
self.uplan = UserFactory(username='planuser')
|
||||
self.rplan = Rower.objects.create(user=self.uplan,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='plan')
|
||||
|
||||
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
|
||||
@@ -484,11 +484,11 @@ class PermissionsViewTests(TestCase):
|
||||
self.uplanpassword = faker.word()
|
||||
self.uplan.set_password(self.uplanpassword)
|
||||
self.uplan.save()
|
||||
|
||||
|
||||
self.upro = UserFactory(username='prouser')
|
||||
self.rpro = Rower.objects.create(user=self.upro,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='pro')
|
||||
|
||||
self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
|
||||
@@ -500,7 +500,7 @@ class PermissionsViewTests(TestCase):
|
||||
self.uplan2 = UserFactory(username='planuser2')
|
||||
self.rplan2 = Rower.objects.create(user=self.uplan2,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='plan')
|
||||
|
||||
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
|
||||
@@ -508,11 +508,11 @@ class PermissionsViewTests(TestCase):
|
||||
self.uplan2password = faker.word()
|
||||
self.uplan2.set_password(self.uplan2password)
|
||||
self.uplan2.save()
|
||||
|
||||
|
||||
self.upro2 = UserFactory(username='prouser2')
|
||||
self.rpro2 = Rower.objects.create(user=self.upro2,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='pro')
|
||||
|
||||
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
|
||||
@@ -524,7 +524,7 @@ class PermissionsViewTests(TestCase):
|
||||
self.ubasic = UserFactory(username='basicuser')
|
||||
self.rbasic = Rower.objects.create(user=self.ubasic,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='basic')
|
||||
|
||||
self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
|
||||
@@ -532,9 +532,9 @@ class PermissionsViewTests(TestCase):
|
||||
self.ubasicpassword = faker.word()
|
||||
self.ubasic.set_password(self.ubasicpassword)
|
||||
self.ubasic.save()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## TeamPro, TeamCoach, TeamSelfCoach
|
||||
|
||||
self.teampro = Team.objects.create(
|
||||
@@ -557,7 +557,7 @@ class PermissionsViewTests(TestCase):
|
||||
def test_coach_groups_create(self):
|
||||
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
|
||||
self.assertTrue(login)
|
||||
|
||||
|
||||
url = reverse('team_create_view')
|
||||
|
||||
response = self.c.get(url)
|
||||
@@ -574,7 +574,7 @@ class PermissionsViewTests(TestCase):
|
||||
form = TeamForm(form_data)
|
||||
if not form.is_valid():
|
||||
print(form.errors)
|
||||
|
||||
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
expected_url = reverse('rower_teams_view')
|
||||
@@ -596,7 +596,7 @@ class PermissionsViewTests(TestCase):
|
||||
form = TeamForm(form_data)
|
||||
if not form.is_valid():
|
||||
print(form.errors)
|
||||
|
||||
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
expected_url = reverse('rower_teams_view')
|
||||
@@ -605,7 +605,7 @@ class PermissionsViewTests(TestCase):
|
||||
self.assertRedirects(response,
|
||||
expected_url=expected_url,
|
||||
status_code=302,target_status_code=200)
|
||||
|
||||
|
||||
## Basic athletes can be member of Coach led group
|
||||
|
||||
## Coach can create planned sessions and team planned sessions
|
||||
@@ -682,7 +682,7 @@ class PermissionsViewTests(TestCase):
|
||||
'theuser':self.ubasic.id,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
response = self.c.get(url)
|
||||
|
||||
self.assertEqual(response.status_code,200)
|
||||
@@ -700,7 +700,7 @@ class PermissionsViewTests(TestCase):
|
||||
'theuser':self.ubasic.id,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
response = self.c.get(url)
|
||||
|
||||
self.assertEqual(response.status_code,403)
|
||||
@@ -747,11 +747,11 @@ class PermissionsViewTests(TestCase):
|
||||
self.assertRedirects(response,
|
||||
expected_url = url,
|
||||
status_code=302,target_status_code=200)
|
||||
|
||||
|
||||
aantal2 = len(Workout.objects.filter(user=self.rbasic))
|
||||
|
||||
self.assertEqual(aantal2,aantal+1)
|
||||
|
||||
|
||||
## Coach can upload on behalf of athlete - if team allows
|
||||
@patch('rowers.dataprep.create_engine')
|
||||
@patch('rowers.dataprep.getsmallrowdata_db',side_effect=mocked_getsmallrowdata_db)
|
||||
@@ -791,11 +791,11 @@ class PermissionsViewTests(TestCase):
|
||||
self.assertRedirects(response,
|
||||
expected_url = url,
|
||||
status_code=302,target_status_code=200)
|
||||
|
||||
|
||||
aantal2 = len(Workout.objects.filter(user=self.rbasic))
|
||||
|
||||
self.assertEqual(aantal2,aantal)
|
||||
|
||||
|
||||
## Coach can edit athlete's workout
|
||||
def test_coach_edit_athlete_workout(self):
|
||||
self.rbasic.team.add(self.teamcoach)
|
||||
@@ -809,13 +809,13 @@ class PermissionsViewTests(TestCase):
|
||||
|
||||
response = self.c.get(url)
|
||||
self.assertEqual(response.status_code,403)
|
||||
|
||||
|
||||
## Self coach can create one group
|
||||
## Self coach cannot create more than one group
|
||||
def test_plan_groups_create(self):
|
||||
login = self.c.login(username=self.uplan.username, password=self.uplanpassword)
|
||||
self.assertTrue(login)
|
||||
|
||||
|
||||
url = reverse('team_create_view')
|
||||
|
||||
response = self.c.get(url)
|
||||
@@ -832,7 +832,7 @@ class PermissionsViewTests(TestCase):
|
||||
form = TeamForm(form_data)
|
||||
if not form.is_valid():
|
||||
print(form.errors)
|
||||
|
||||
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
expected_url = reverse('rower_teams_view')
|
||||
@@ -854,7 +854,7 @@ class PermissionsViewTests(TestCase):
|
||||
form = TeamForm(form_data)
|
||||
if not form.is_valid():
|
||||
print(form.errors)
|
||||
|
||||
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
expected_url = reverse('paidplans')
|
||||
@@ -927,7 +927,7 @@ class PermissionsViewTests(TestCase):
|
||||
'theuser':self.ubasic.id,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
response = self.c.get(url)
|
||||
|
||||
self.assertEqual(response.status_code,403)
|
||||
@@ -952,7 +952,7 @@ class PermissionsViewTests(TestCase):
|
||||
def test_pro_groups_create(self):
|
||||
login = self.c.login(username=self.upro.username, password=self.upropassword)
|
||||
self.assertTrue(login)
|
||||
|
||||
|
||||
url = reverse('team_create_view')
|
||||
|
||||
response = self.c.get(url)
|
||||
@@ -969,7 +969,7 @@ class PermissionsViewTests(TestCase):
|
||||
form = TeamForm(form_data)
|
||||
if not form.is_valid():
|
||||
print(form.errors)
|
||||
|
||||
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
expected_url = reverse('rower_teams_view')
|
||||
@@ -991,7 +991,7 @@ class PermissionsViewTests(TestCase):
|
||||
form = TeamForm(form_data)
|
||||
if not form.is_valid():
|
||||
print(form.errors)
|
||||
|
||||
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
expected_url = reverse('paidplans')
|
||||
@@ -1049,7 +1049,7 @@ class PermissionsViewTests(TestCase):
|
||||
'theuser':self.ubasic.id,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
response = self.c.get(url)
|
||||
|
||||
self.assertEqual(response.status_code,403)
|
||||
@@ -1095,7 +1095,7 @@ class PermissionsViewTests(TestCase):
|
||||
|
||||
response = self.c.get(url)
|
||||
self.assertEqual(response.status_code,200)
|
||||
|
||||
|
||||
|
||||
## Self Coach users can see team members' workout, but not edit
|
||||
def test_plan_edit_athlete_workout(self):
|
||||
@@ -1117,7 +1117,7 @@ class PermissionsViewTests(TestCase):
|
||||
|
||||
response = self.c.get(url)
|
||||
self.assertEqual(response.status_code,200)
|
||||
|
||||
|
||||
|
||||
## Basic users can see team members' workout, but not edit
|
||||
def test_basic_edit_athlete_workout(self):
|
||||
@@ -1148,7 +1148,7 @@ class PermissionsViewTests(TestCase):
|
||||
|
||||
response = self.c.get(url)
|
||||
self.assertEqual(response.status_code,200)
|
||||
|
||||
|
||||
# workflow
|
||||
url = reverse('workout_workflow_view',
|
||||
kwargs={'id':encoder.encode_hex(self.uplan2_workouts[0].id)}
|
||||
@@ -1165,7 +1165,7 @@ class PermissionsViewTests(TestCase):
|
||||
response = self.c.get(url)
|
||||
self.assertEqual(response.status_code,200)
|
||||
|
||||
|
||||
|
||||
## Pro users (and higher) can join group led by other Pro (or higher) user
|
||||
def test_team_member_request_pro_pro(self):
|
||||
login = self.c.login(username=self.upro.username,password=self.upropassword)
|
||||
@@ -1215,7 +1215,7 @@ class PermissionsCoachingTests(TestCase):
|
||||
self.ucoach = UserFactory(username='coachuser')
|
||||
self.rcoach = Rower.objects.create(user=self.ucoach,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='coach',clubsize=10)
|
||||
|
||||
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
|
||||
@@ -1226,11 +1226,11 @@ class PermissionsCoachingTests(TestCase):
|
||||
self.ucoachpassword = faker.word()
|
||||
self.ucoach.set_password(self.ucoachpassword)
|
||||
self.ucoach.save()
|
||||
|
||||
|
||||
self.uplan = UserFactory(username='planuser')
|
||||
self.rplan = Rower.objects.create(user=self.uplan,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='plan')
|
||||
|
||||
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
|
||||
@@ -1238,11 +1238,11 @@ class PermissionsCoachingTests(TestCase):
|
||||
self.password = faker.word()
|
||||
self.uplan.set_password(self.password)
|
||||
self.uplan.save()
|
||||
|
||||
|
||||
self.upro = UserFactory(username='prouser')
|
||||
self.rpro = Rower.objects.create(user=self.upro,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='pro')
|
||||
|
||||
self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
|
||||
@@ -1254,7 +1254,7 @@ class PermissionsCoachingTests(TestCase):
|
||||
self.uplan2 = UserFactory(username='planuser2')
|
||||
self.rplan2 = Rower.objects.create(user=self.uplan2,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='plan')
|
||||
|
||||
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
|
||||
@@ -1262,11 +1262,11 @@ class PermissionsCoachingTests(TestCase):
|
||||
self.password = faker.word()
|
||||
self.uplan2.set_password(self.password)
|
||||
self.uplan2.save()
|
||||
|
||||
|
||||
self.upro2 = UserFactory(username='prouser2')
|
||||
self.rpro2 = Rower.objects.create(user=self.upro2,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='pro')
|
||||
|
||||
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
|
||||
@@ -1278,7 +1278,7 @@ class PermissionsCoachingTests(TestCase):
|
||||
self.ubasic = UserFactory(username='basicuser')
|
||||
self.rbasic = Rower.objects.create(user=self.ubasic,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,gdproptindate=timezone.now(),
|
||||
gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
|
||||
rowerplan='basic')
|
||||
|
||||
self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
|
||||
@@ -1286,9 +1286,9 @@ class PermissionsCoachingTests(TestCase):
|
||||
self.ubasicpassword = faker.word()
|
||||
self.ubasic.set_password(self.ubasicpassword)
|
||||
self.ubasic.save()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## TeamPro, TeamCoach, TeamSelfCoach
|
||||
|
||||
self.teampro = Team.objects.create(
|
||||
@@ -1360,7 +1360,7 @@ class PermissionsCoachingTests(TestCase):
|
||||
coachingrequests = CoachOffer.objects.filter(user=self.ubasic)
|
||||
self.assertEqual(len(coachingrequests),0)
|
||||
|
||||
|
||||
|
||||
def test_athlete_request_coach_reject(self):
|
||||
login = self.c.login(username=self.ubasic.username,password=self.ubasicpassword)
|
||||
self.assertTrue(login)
|
||||
@@ -1421,7 +1421,7 @@ class PermissionsCoachingTests(TestCase):
|
||||
coachingrequests = CoachOffer.objects.filter(user=self.ubasic)
|
||||
self.assertEqual(len(coachingrequests),0)
|
||||
|
||||
|
||||
|
||||
def test_athlete_request_coach_accept_coach_drop(self):
|
||||
login = self.c.login(username=self.ubasic.username,password=self.ubasicpassword)
|
||||
self.assertTrue(login)
|
||||
@@ -1512,7 +1512,7 @@ class PermissionsCoachingTests(TestCase):
|
||||
|
||||
coaches = teams.rower_get_coaches(self.rbasic)
|
||||
self.assertEqual(len(coaches),0)
|
||||
|
||||
|
||||
def test_coach_offer_athlete_accept_coach_drop(self):
|
||||
login = self.c.login(username=self.ucoach.username,password=self.ucoachpassword)
|
||||
self.assertTrue(login)
|
||||
@@ -1558,7 +1558,7 @@ class PermissionsCoachingTests(TestCase):
|
||||
|
||||
coaches = teams.rower_get_coaches(self.rbasic)
|
||||
self.assertEqual(len(coaches),0)
|
||||
|
||||
|
||||
|
||||
def test_athlete_request_coach_accept_athlete_drop(self):
|
||||
login = self.c.login(username=self.ubasic.username,password=self.ubasicpassword)
|
||||
@@ -1611,7 +1611,7 @@ class PermissionsCoachingTests(TestCase):
|
||||
coaches = teams.rower_get_coaches(self.rbasic)
|
||||
self.assertEqual(len(coaches),0)
|
||||
|
||||
|
||||
|
||||
# coach related
|
||||
|
||||
## coach disappears from list when downgrading
|
||||
|
||||
Reference in New Issue
Block a user