forked from DGNum/gestioCOF
bda.tests -- Split view tests and use shared test helpers
This commit is contained in:
parent
a71fbb0ed3
commit
f8610d4ff1
3 changed files with 244 additions and 174 deletions
17
bda/tests/utils.py
Normal file
17
bda/tests/utils.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
def create_user(username, is_cof=False, is_buro=False):
|
||||
user = User.objects.create_user(username=username, password=username)
|
||||
user.profile.is_cof = is_cof
|
||||
user.profile.is_buro = is_buro
|
||||
user.profile.save()
|
||||
return user
|
||||
|
||||
|
||||
def user_is_cof(user):
|
||||
return (user is not None) and user.profile.is_cof
|
||||
|
||||
|
||||
def user_is_staff(user):
|
||||
return (user is not None) and user.profile.is_buro
|
Loading…
Add table
Add a link
Reference in a new issue