kfet.tests -- Add tests for perform_operations view

This commit is contained in:
Aurélien Delobelle 2018-10-03 18:01:19 +02:00
parent 22011faba9
commit 507a59c914
2 changed files with 1437 additions and 8 deletions

File diff suppressed because it is too large Load diff

View file

@ -178,7 +178,9 @@ class ViewTestCaseMixin(TestCaseMixin):
During setup, three users are created with their kfet account:
- 'user': a basic user without any permission, account trigramme: 000,
- 'team': a user with kfet.is_team permission, account trigramme: 100,
- 'root': a superuser, account trigramme: 200.
- 'root': a superuser, account trigramme: 200,
- 'liq': if class attribute 'with_liq' is 'True', account
trigramme: LIQ.
Their password is their username.
One can create additionnal users with 'get_users_extra' method, or prevent
@ -221,6 +223,8 @@ class ViewTestCaseMixin(TestCaseMixin):
auth_user = None
auth_forbidden = []
with_liq = False
def setUp(self):
"""
Warning: Do not forget to call super().setUp() in subclasses.
@ -262,7 +266,7 @@ class ViewTestCaseMixin(TestCaseMixin):
"""
# Format desc: username, password, trigramme
return {
users_base = {
# user, user, 000
'user': create_user(),
# team, team, 100
@ -270,6 +274,9 @@ class ViewTestCaseMixin(TestCaseMixin):
# root, root, 200
'root': create_root(),
}
if self.with_liq:
users_base['liq'] = create_user('liq', 'LIQ')
return users_base
@cached_property
def users_base(self):