making pass tests
This commit is contained in:
@@ -949,7 +949,7 @@ def check_teams_on_change(sender, **kwargs):
|
|||||||
#if instance.protrialexpires < datetime.date.today() and instance.plantrialexpires < datetime.date.today():
|
#if instance.protrialexpires < datetime.date.today() and instance.plantrialexpires < datetime.date.today():
|
||||||
for id in pk_set:
|
for id in pk_set:
|
||||||
team = Team.objects.get(id=id)
|
team = Team.objects.get(id=id)
|
||||||
if not can_join_team(instance,team):
|
if not can_join_team(instance.user,team):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"You cannot join a team led by a Pro, Free Coach Plan or Self-Coach user"
|
"You cannot join a team led by a Pro, Free Coach Plan or Self-Coach user"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ def is_protrial(user):
|
|||||||
|
|
||||||
ispromember = is_promember | is_protrial
|
ispromember = is_promember | is_protrial
|
||||||
|
|
||||||
can_have_teams = ispromember
|
can_have_teams = ispromember | is_coach
|
||||||
|
|
||||||
@rules.predicate
|
@rules.predicate
|
||||||
def can_add_team(user):
|
def can_add_team(user):
|
||||||
|
|||||||
@@ -1112,6 +1112,7 @@ class PermissionsViewTests(TestCase):
|
|||||||
## Pro cannot run analytics on behalf of athlete
|
## Pro cannot run analytics on behalf of athlete
|
||||||
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
|
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
|
||||||
def test_pro_edit_athlete_analysis(self,mocked_df):
|
def test_pro_edit_athlete_analysis(self,mocked_df):
|
||||||
|
with transaction.atomic():
|
||||||
self.rpro.team.add(self.teampro)
|
self.rpro.team.add(self.teampro)
|
||||||
|
|
||||||
login = self.c.login(username=self.upro2.username, password=self.upro2password)
|
login = self.c.login(username=self.upro2.username, password=self.upro2password)
|
||||||
|
|||||||
@@ -4877,7 +4877,7 @@ def team_workout_upload_view(request,message="",
|
|||||||
workouttype = form.cleaned_data['workouttype']
|
workouttype = form.cleaned_data['workouttype']
|
||||||
if rowerform.is_valid():
|
if rowerform.is_valid():
|
||||||
u = rowerform.cleaned_data['user']
|
u = rowerform.cleaned_data['user']
|
||||||
if can_add_workout_member(user,u.rower):
|
if can_add_workout_member(request.user,u.rower):
|
||||||
r = getrower(u)
|
r = getrower(u)
|
||||||
else:
|
else:
|
||||||
message = 'Please select a rower'
|
message = 'Please select a rower'
|
||||||
|
|||||||
Reference in New Issue
Block a user