summaryrefslogtreecommitdiff
path: root/yaksh/test_views.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r--yaksh/test_views.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 8592031..5bd55eb 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -4517,6 +4517,13 @@ class TestQuestionPaper(TestCase):
)
self.float_based_testcase.save()
+ # Question with tag
+ self.tagged_que = Question.objects.create(
+ summary="Test_tag_question", description="Test Tag",
+ points=1.0, language="python", type="float", user=self.teacher
+ )
+ self.tagged_que.tags.add("test_tag")
+
self.questions_list = [self.question_mcq, self.question_mcc,
self.question_int, self.question_str,
self.question_float]
@@ -4919,6 +4926,18 @@ class TestQuestionPaper(TestCase):
self.questions_list)
self.assertEqual(response.context['qpaper'], self.question_paper)
+ # Get questions using tags for question paper
+ search_tag = [tag for tag in self.tagged_que.tags.all()]
+ response = self.client.post(
+ reverse('yaksh:designquestionpaper',
+ kwargs={"quiz_id": self.quiz.id,
+ "course_id": self.course.id,
+ "questionpaper_id": self.question_paper.id}),
+ data={"question_tags": search_tag})
+
+ self.assertEqual(response.context["questions"][0], self.tagged_que)
+
+ # Add random questions in question paper
response = self.client.post(
reverse('yaksh:designquestionpaper',
kwargs={"quiz_id": self.quiz.id,
@@ -4929,6 +4948,7 @@ class TestQuestionPaper(TestCase):
'marks': ['1.0'], 'question_type': ['code'],
'add-random': ['']}
)
+
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'yaksh/design_questionpaper.html')
random_set = response.context['random_sets'][0]