]> git.parisson.com Git - django_quiz.git/commitdiff
looking for ways to black box more of the views functions relating to
authorTom Walker <tomwalker0472@gmail.com>
Sun, 22 Jun 2014 18:11:14 +0000 (19:11 +0100)
committerTom Walker <tomwalker0472@gmail.com>
Sun, 22 Jun 2014 18:11:14 +0000 (19:11 +0100)
the questions

quiz/tests.py

index c7562da056ba7d2aa42d652fb688a22829f604aa..3df4e08981c2e4235b16728ec41016633f2e9809 100644 (file)
@@ -1,10 +1,11 @@
 # -*- coding: iso-8859-15 -*-
 
-from django.contrib.auth.models import User
+from django.contrib.auth.models import User, AnonymousUser
 from django.test import TestCase
-from django.test.client import Client
+from django.test.client import Client, RequestFactory
 
 from quiz.models import Category, Quiz, Progress, Sitting, Question
+from quiz.views import quiz_take
 from multichoice.models import MCQuestion
 from true_false.models import TF_Question
 
@@ -309,8 +310,20 @@ class TestQuestionViewsAnon(TestCase):
                                               content = "squeek",)
         question2.quiz.add(quiz1)
 
+        self.factory = RequestFactory()
 
-class TestQuestionViewsAnon(TestCase):
+    def test_quiz_take_anon(self):
+        request = self.client.get('/q/tq1/')
+        request.user = AnonymousUser()
+        request.session = self.client.session
+        request.session['set_expiry'] = 0
+
+        print request
+
+        self.assertContains(response, 'Sign up')
+
+
+class TestQuestionViewsUser(TestCase):
 
     def setUp(self):
         Category.objects.new_category(category = "elderberries")