8
8
from journalmanager .tests import modelfactories
9
9
10
10
from . import modelfactories as editorial_modelfactories
11
- from editorialmanager .models import EditorialMember , EditorialBoard , RoleType , RoleTypeTranslation
11
+ from editorialmanager .models import (EditorialMember ,
12
+ EditorialBoard ,
13
+ RoleType ,
14
+ RoleTypeTranslation )
12
15
from audit_log .models import AuditLogEntry , ADDITION , CHANGE , DELETION
13
16
14
17
@@ -64,7 +67,7 @@ def test_editor_edit_journal_with_valid_formdata(self):
64
67
of the list.
65
68
66
69
In order to take this action, the user needs be part of this group:
67
- ``superuser`` or ``editors`` or ``librarian``
70
+ ``superuser`` or ``editors`` or ``librarian`` or ``trainee``
68
71
"""
69
72
70
73
use_license = modelfactories .UseLicenseFactory .create ()
@@ -129,7 +132,7 @@ def test_add_user_as_editor_formdata(self):
129
132
the editor area and journal have a new editor of the journal
130
133
131
134
In order to take this action, the user needs be part of this group:
132
- ``superuser`` or ``librarian``
135
+ ``superuser`` or ``librarian`` or ``trainee``
133
136
"""
134
137
135
138
group = modelfactories .GroupFactory (name = "Editors" )
@@ -505,8 +508,9 @@ def test_DELETE_board_member_valid_POST_is_valid(self):
505
508
506
509
class EditorialMemberFormAsLibrarianTests (EditorialMemberFormAsEditorTests ):
507
510
"""
508
- Excecute the same tests that an Editors (EditorialMemberFormAsEditorTests), the setUp is almost the same.
509
- Only change is that the self.user is assigned as a member of "Librarian" group instead of "Editors" group.
511
+ Excecute the same tests that an Editors (EditorialMemberFormAsEditorTests),
512
+ the setUp is almost the same.Only change is that the self.user is assigned
513
+ as a member of "Librarian" group instead of "Editors" group.
510
514
"""
511
515
def setUp (self ):
512
516
super (EditorialMemberFormAsLibrarianTests , self ).setUp ()
@@ -522,6 +526,26 @@ def tearDown(self):
522
526
super (EditorialMemberFormAsLibrarianTests , self ).tearDown ()
523
527
524
528
529
+ class EditorialMemberFormAsTraineeTests (EditorialMemberFormAsEditorTests ):
530
+ """
531
+ Excecute the same tests that an Editors (EditorialMemberFormAsEditorTests),
532
+ the setUp is almost the same. Only change is that the self.user is assigned
533
+ as a member of "Trainee" group instead of "Editors" group.
534
+ """
535
+ def setUp (self ):
536
+ super (EditorialMemberFormAsTraineeTests , self ).setUp ()
537
+ # change user group to belong to Trainee group
538
+ self .user .groups .clear ()
539
+ group = modelfactories .GroupFactory (name = "Trainee" )
540
+ self .user .groups .add (group )
541
+ self .user .save ()
542
+
543
+ _add_required_permission_to_group (group )
544
+
545
+ def tearDown (self ):
546
+ super (EditorialMemberFormAsTraineeTests , self ).tearDown ()
547
+
548
+
525
549
class MembersSortingOnActionTests (WebTest ):
526
550
527
551
def setUp (self ):
0 commit comments