diff --git a/flashcards/tests/test_api.py b/flashcards/tests/test_api.py index b7f0de7..6d3d02c 100644 --- a/flashcards/tests/test_api.py +++ b/flashcards/tests/test_api.py @@ -368,3 +368,19 @@ class SectionViewSetTest(APITestCase): self.user.save() response = self.client.get('/api/sections/1/ordered_deck/') self.assertEqual(response.status_code, HTTP_200_OK) + + +class UserFlashcardQuizTests(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.section = Section.objects.get(pk=1) + self.flashcard = Flashcard(text="This is a flashcard", section=self.section, material_date=now(), + author=self.user, mask={(0,4), (5,7)}) + self.flashcard.save() + self.flashcard.refresh_from_db() + self.user_flashcard = UserFlashcard(flashcard=self.flashcard, user=self.user, + mask=self.flashcard.mask, pulled=datetime.now()) + self.user_flashcard.save() diff --git a/flashy/urls.py b/flashy/urls.py index a3fc6b0..27a8b4a 100644 --- a/flashy/urls.py +++ b/flashy/urls.py @@ -1,7 +1,7 @@ from django.conf.urls import include, url from django.contrib import admin from flashcards.views import SectionViewSet, UserDetail, FlashcardViewSet, UserSectionListView, request_password_reset, \ - reset_password, logout, login, register + reset_password, logout, login, register, UserFlashcardQuizViewSet from flashy.frontend_serve import serve_with_default from flashy.settings import DEBUG, IN_PRODUCTION from rest_framework.routers import DefaultRouter @@ -10,6 +10,7 @@ from flashcards.api import * router = DefaultRouter() router.register(r'sections', SectionViewSet) router.register(r'flashcards', FlashcardViewSet) +router.register(r'study', UserFlashcardQuizViewSet) urlpatterns = [ url(r'^api/docs/', include('rest_framework_swagger.urls')),