Fix unit test

This commit is contained in:
Ramon Wenger 2021-08-25 15:02:57 +02:00
parent f9e7534fff
commit 75ca2f552c
1 changed files with 13 additions and 3 deletions

View File

@ -56,7 +56,11 @@ def create_users(data=None):
hep_id = 1 hep_id = 1
for school_class in data: for school_class in data:
first, last, avatar_url = school_class.get('teacher') try:
first, last, avatar_url = school_class.get('teacher')
except ValueError:
first, last = school_class.get('teacher')
avatar_url = ''
teacher = UserFactory( teacher = UserFactory(
username='{}.{}'.format(first, last).lower(), username='{}.{}'.format(first, last).lower(),
first_name=first, first_name=first,
@ -71,7 +75,12 @@ def create_users(data=None):
students = [] students = []
for first, last in school_class.get('students'): for student_data in school_class.get('students'):
try:
first, last, avatar_url = student_data
except ValueError:
first, last = student_data
avatar_url = ''
hep_id += 1 hep_id += 1
student = create_student( student = create_student(
username='{}.{}'.format(first, last).lower(), username='{}.{}'.format(first, last).lower(),
@ -80,7 +89,8 @@ def create_users(data=None):
email='{}.{}@skillbox.example'.format(first, last).lower(), email='{}.{}@skillbox.example'.format(first, last).lower(),
onboarding_visited=True, onboarding_visited=True,
license_expiry_date=in_a_week, license_expiry_date=in_a_week,
hep_id=hep_id hep_id=hep_id,
avatar_url=avatar_url
) )
students.append(student) students.append(student)