From 0117d91751a4f211e7fc803f0052f964c24e38b8 Mon Sep 17 00:00:00 2001 From: CKW Date: Sat, 16 May 2015 22:51:12 -0700 Subject: [PATCH] test hide flashcard --- flashcards/tests/test_api.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/flashcards/tests/test_api.py b/flashcards/tests/test_api.py index 2901f56..f99ddd3 100644 --- a/flashcards/tests/test_api.py +++ b/flashcards/tests/test_api.py @@ -200,7 +200,8 @@ class SectionViewSetTest(APITestCase): def setUp(self): self.client.login(email='none@none.com', password='1234') self.user = User.objects.get(email='none@none.com') - self.flashcard = Flashcard(text="jason", section=Section.objects.get(pk=1), material_date=now(), author=self.user) + self.flashcard = Flashcard(text="jason", section=Section.objects.get(pk=1), material_date=now(), + author=self.user) self.flashcard.save() self.section = Section.objects.get(pk=1) @@ -280,4 +281,20 @@ class SectionViewSetTest(APITestCase): response = self.client.get('/api/sections/1/ordered_deck/') self.assertEqual(response.status_code, HTTP_200_OK) - def test_hide_card(self): + +class FlashcardViewSetTest(APITestCase): + fixtures = ['testusers', 'testsections'] + + def setUp(self): + self.client.login(email='none@none.com', password='1234') + self.user = User.objects.get(email='none@none.com') + self.flashcard = Flashcard(text="jason", section=Section.objects.get(pk=1), material_date=now(), + author=self.user) + self.flashcard.save() + self.section = Section.objects.get(pk=1) + + def test_hide_flashcard(self): + url = '/api/flashcards/1/hide/' + data = {1, ''} + response = self.client.post(url, data, format='json') + self.assertEqual(response.status_code, HTTP_204_NO_CONTENT) \ No newline at end of file -- 1.9.1