Commit a0e0db361f432611829259dffcbbec18586c44eb
1 parent
07a9ebffba
Exists in
master
bad merge
Showing 1 changed file with 6 additions and 14 deletions Side-by-side Diff
flashcards/tests/test_api.py
View file @
a0e0db3
1 | 1 | from django.core import mail |
2 | -<<<<<<< HEAD | |
3 | -from flashcards.models import User | |
4 | -from rest_framework.generics import RetrieveAPIView | |
5 | -======= | |
6 | 2 | from flashcards.models import User, Section, Flashcard |
7 | ->>>>>>> 2a9edd990f102b292ef4fb59c0688f6ed5ab56f5 | |
8 | 3 | from rest_framework.status import HTTP_204_NO_CONTENT, HTTP_201_CREATED, HTTP_200_OK, HTTP_401_UNAUTHORIZED |
9 | 4 | from rest_framework.test import APITestCase |
10 | 5 | from re import search |
11 | 6 | |
12 | 7 | |
13 | 8 | |
14 | 9 | |
... | ... | @@ -193,24 +188,21 @@ |
193 | 188 | self.client.delete(url) |
194 | 189 | self.assertFalse(User.objects.filter(email='none@none.com').exists()) |
195 | 190 | |
191 | + | |
196 | 192 | class FlashcardDetailTest(APITestCase): |
197 | 193 | def setUp(self): |
198 | - section = Section( department="cse", course_num="5", \ | |
199 | - course_title="cool course", \ | |
200 | - instructor="gary", quarter="fa15") | |
194 | + section = Section(department="cse", course_num="5", course_title="cool course", instructor="gary", | |
195 | + quarter="fa15") | |
201 | 196 | section.save() |
202 | 197 | |
203 | - user = User.objects.create_user( email="jacob@aaa.com", \ | |
204 | - password="top_secret" ) | |
198 | + user = User.objects.create_user(email="jacob@aaa.com", password="top_secret") | |
205 | 199 | user.save() |
206 | 200 | |
207 | - self.flashcard = Flashcard( text="jason", section=section, \ | |
208 | - material_date=now(), author=user ) | |
201 | + self.flashcard = Flashcard(text="jason", section=section, material_date=now(), author=user) | |
209 | 202 | self.flashcard.save() |
210 | 203 | |
211 | 204 | def test_get_flashcard(self): |
212 | - | |
213 | - response = self.client.get("/api/flashcards/%d"%self.flashcard.id, format="json") | |
205 | + response = self.client.get("/api/flashcards/%d" % self.flashcard.id, format="json") | |
214 | 206 | self.assertEqual(response.status_code, HTTP_200_OK) |
215 | 207 | self.assertEqual(response.data["text"], "jason") |