diff --git a/flashcards/tests/test_api.py b/flashcards/tests/test_api.py index bc5d340..a154092 100644 --- a/flashcards/tests/test_api.py +++ b/flashcards/tests/test_api.py @@ -1,10 +1,5 @@ from django.core import mail -<<<<<<< HEAD -from flashcards.models import User -from rest_framework.generics import RetrieveAPIView -======= from flashcards.models import User, Section, Flashcard ->>>>>>> 2a9edd990f102b292ef4fb59c0688f6ed5ab56f5 from rest_framework.status import HTTP_204_NO_CONTENT, HTTP_201_CREATED, HTTP_200_OK, HTTP_401_UNAUTHORIZED from rest_framework.test import APITestCase from re import search @@ -193,23 +188,20 @@ class DeleteUserTest(APITestCase): self.client.delete(url) self.assertFalse(User.objects.filter(email='none@none.com').exists()) + class FlashcardDetailTest(APITestCase): def setUp(self): - section = Section( department="cse", course_num="5", \ - course_title="cool course", \ - instructor="gary", quarter="fa15") + section = Section(department="cse", course_num="5", course_title="cool course", instructor="gary", + quarter="fa15") section.save() - user = User.objects.create_user( email="jacob@aaa.com", \ - password="top_secret" ) + user = User.objects.create_user(email="jacob@aaa.com", password="top_secret") user.save() - self.flashcard = Flashcard( text="jason", section=section, \ - material_date=now(), author=user ) + self.flashcard = Flashcard(text="jason", section=section, material_date=now(), author=user) self.flashcard.save() def test_get_flashcard(self): - - response = self.client.get("/api/flashcards/%d"%self.flashcard.id, format="json") + response = self.client.get("/api/flashcards/%d" % self.flashcard.id, format="json") self.assertEqual(response.status_code, HTTP_200_OK) self.assertEqual(response.data["text"], "jason")