From c2666439094534b92beb4f05de2b31bf0683636a Mon Sep 17 00:00:00 2001 From: Andrew Buss <abuss@ucsd.edu> Date: Fri, 1 May 2015 12:17:44 -0700 Subject: [PATCH] fixed up section list test error --- flashcards/tests/test_models.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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) -- 1.9.1