diff --git a/flashcards/tests/test_models.py b/flashcards/tests/test_models.py index 6b29ab8..aca606b 100644 --- a/flashcards/tests/test_models.py +++ b/flashcards/tests/test_models.py @@ -1,11 +1,21 @@ from django.test import TestCase -from flashcards.models import User +from flashcards.models import User, Section class UserTests(TestCase): def setUp(self): - u = User.objects.create(email="none@none.com",password="1234") + User.objects.create(email="none@none.com", password="1234") + Section.objects.create(department='dept', + course_num='101a', + course_title='how 2 test', + instructor='George Lucas', + quarter='SP15') def test_section_list(self): - u = User.objects.get(email="none@none.com") - u.sections.add(None) + section = Section.objects.get(course_num='101a') + user = User.objects.get(email="none@none.com") + self.assertNotIn(section, user.sections.all()) + user.sections.add(section) + self.assertIn(section, user.sections.all()) + user.sections.add(section) + self.assertEqual(user.sections.count(), 1)