Browse Source

Fix hesel v testdatech. Poučení: Testovat testdata

middleware_test
Jonas Havelka 4 years ago
parent
commit
0f7e6e0d6b
  1. 10
      seminar/testutils.py

10
seminar/testutils.py

@ -134,9 +134,9 @@ def gen_resitele(rnd, osoby, skoly):
if not (rand % 8 == 0):
if not os.user:
if x:
user = User.objects.create(username='r'+str(x), email=os.email, password='r')
user = User.objects.create_user(username='r'+str(x), email=os.email, password='r')
else:
user = User.objects.create(username='r', email=os.email, password='r')
user = User.objects.create_user(username='r', email=os.email, password='r')
x += 1
os.user = user
os.save()
@ -193,9 +193,9 @@ def gen_organizatori(rnd, osoby, last_rocnik):
do = None
if not os.user:
if x:
user = User.objects.create(username='o'+str(x), email=os.email, password='o')
user = User.objects.create_user(username='o'+str(x), email=os.email, password='o')
else:
user = User.objects.create(username='o', email=os.email, password='o')
user = User.objects.create_user(username='o', email=os.email, password='o')
x += 1
os.user = user
os.save()
@ -811,7 +811,7 @@ def create_test_data(size = 6, rnd = None):
usernames = ['anet', 'bara', 'cyril', 'david', 'eva', 'filip']
users = []
for usr in usernames[:size]:
u = User.objects.create(username=usr, password=usr)
u = User.objects.create_user(username=usr, password=usr)
u.first_name = usr.capitalize()
u.save()
users.append(u)

Loading…
Cancel
Save