Commit 0eff34260404622e332337cb9263e2ec8238d054
1 parent
c91a932f6e
Exists in
master
test hide second push
Showing 1 changed file with 17 additions and 1 deletions Side-by-side Diff
flashcards/tests/test_api.py
View file @
0eff342
... | ... | @@ -280,5 +280,21 @@ |
280 | 280 | response = self.client.get('/api/sections/1/ordered_deck/') |
281 | 281 | self.assertEqual(response.status_code, HTTP_200_OK) |
282 | 282 | |
283 | - def test_hide_card(self): | |
283 | + | |
284 | +class FlashcardViewSetTest(APITestCase): | |
285 | + fixtures = ['testusers', 'testsections'] | |
286 | + | |
287 | + def setUp(self): | |
288 | + self.client.login(email='none@none.com', password='1234') | |
289 | + self.user = User.objects.get(email='none@none.com') | |
290 | + self.flashcard = Flashcard(text="jason", section=Section.objects.get(pk=1), material_date=now(), | |
291 | + author=self.user) | |
292 | + self.flashcard.save() | |
293 | + self.section = Section.objects.get(pk=1) | |
294 | + | |
295 | + def test_hide_flashcard(self): | |
296 | + url = '/api/flashcards/1/hide/' | |
297 | + data = {1, ''} | |
298 | + response = self.client.post(url, data, format='json') | |
299 | + self.assertEqual(response.status_code, HTTP_204_NO_CONTENT) |