def create_students(count=2): for i in range(count): Student.create_student( username=STUDENT_LIST[i], user_json=requests.get("https://teamtreehouse.com/{}.json".format(STUDENT_LIST[i])).json(), email='test_{}@example.com'.format(i), first_name='John', last_name='Doe', password='******', github_username=STUDENT_LIST[i], city='Portland', state='OR', country='USA' )
def test_create_duplicate_student(self): with test_database(TEST_DB, (Student,)): self.create_students() with self.assertRaises(ValueError): Student.create_student( username='******', user_json=requests.get("https://teamtreehouse.com/kenalger.json").json(), email='*****@*****.**', first_name='John', last_name='Doe', password='******', github_username='******', city='Portland', state='OR', country='USA' )