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