Private
Public Access
1
0

added permissions in analysis views

This commit is contained in:
Sander Roosendaal
2020-01-16 20:09:32 +01:00
parent 28710dbdd6
commit 4aa3649a7c
6 changed files with 48 additions and 8 deletions

View File

@@ -841,6 +841,8 @@ class PermissionsViewTests(TestCase):
self.assertEqual(response.status_code,200)
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
def test_coach_edit_athlete_analysis_not(self,mocked_df):
self.rbasic.team.add(self.teamcoach)
@@ -851,7 +853,7 @@ class PermissionsViewTests(TestCase):
url = reverse('cumstats',
kwargs={
'theuser':self.ubasic.id,
'userid':self.ubasic.id,
}
)
@@ -859,6 +861,24 @@ class PermissionsViewTests(TestCase):
self.assertEqual(response.status_code,403)
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
def test_coach_edit_athlete_analysis_not2(self,mocked_df):
self.rbasic.team.add(self.teamcoach)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
self.assertTrue(login)
url = reverse('analysis_new',
kwargs={
'userid':self.ubasic.id,
}
)
response = self.c.get(url)
self.assertEqual(response.status_code,403)
## Coach can upload on behalf of athlete - if team allows
@patch('rowers.dataprep.create_engine')

View File

@@ -5,7 +5,8 @@ from __future__ import unicode_literals
#from __future__ import print_function
from .statements import *
nu = datetime.datetime.now()self.ucoach = UserFactory()
nu = datetime.datetime.now()
self.ucoach = UserFactory()
self.rcoach = Rower.objects.create(
user=self.ucoach,
birthdate=faker.profile()['birthdate'],