From 02705e4c676750291b6a5c4ea14e2947f29cb6c7 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 8 Mar 2018 11:53:39 +0530 Subject: Allow to search the questions in design question paper --- yaksh/test_views.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'yaksh/test_views.py') diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 3b27338..8fa4747 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -4156,6 +4156,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] @@ -4510,6 +4517,16 @@ 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) + class TestLearningModule(TestCase): def setUp(self): -- cgit