diff options
author | mahesh | 2017-08-18 02:13:10 +0530 |
---|---|---|
committer | mahesh | 2017-08-18 12:10:08 +0530 |
commit | 0ffc49f91dd9e21a6b9917b7841999bf853c3c9f (patch) | |
tree | 59fee2d353d6de5042a5fe1b0df5b5b34f62d8f9 | |
parent | a9c4aab85fb9b8edce53212548f8d0c285832dc4 (diff) | |
download | online_test-0ffc49f91dd9e21a6b9917b7841999bf853c3c9f.tar.gz online_test-0ffc49f91dd9e21a6b9917b7841999bf853c3c9f.tar.bz2 online_test-0ffc49f91dd9e21a6b9917b7841999bf853c3c9f.zip |
Adds test cases for yaml
- Fixes selenium test cases, test_models, test_views
- Fixes create demo question paper
-rw-r--r-- | yaksh/live_server_tests/selenium_test.py | 6 | ||||
-rw-r--r-- | yaksh/models.py | 7 | ||||
-rw-r--r-- | yaksh/test_models.py | 6 | ||||
-rw-r--r-- | yaksh/test_views.py | 10 |
4 files changed, 21 insertions, 8 deletions
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py index 277f08e..aefb724 100644 --- a/yaksh/live_server_tests/selenium_test.py +++ b/yaksh/live_server_tests/selenium_test.py @@ -111,9 +111,9 @@ class SeleniumTest(): ) start_exam_elem.click() - self.test_c_question(question_label=2) - self.test_python_question(question_label=3) - self.test_bash_question(question_label=1) + self.test_c_question(question_label=7) + self.test_python_question(question_label=5) + self.test_bash_question(question_label=4) def close_quiz(self): quit_link_elem = WebDriverWait(self.driver, 5).until( diff --git a/yaksh/models.py b/yaksh/models.py index 476bc16..b4c665c 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -909,8 +909,13 @@ class QuestionPaper(models.Model): total_marks=6.0, shuffle_questions=True ) + summaries = ['Roots of quadratic equation', 'Print Output', + 'Adding decimals', 'For Loop over String', + 'Hello World in File', 'Extract columns from files', + 'Check Palindrome', 'Add 3 numbers', 'Reverse a string' + ] questions = Question.objects.filter(active=True, - summary="Yaksh Demo Question", + summary__in=summaries, user=user) q_order = [str(que.id) for que in questions] question_paper.fixed_question_order = ",".join(q_order) diff --git a/yaksh/test_models.py b/yaksh/test_models.py index d5ac394..a940c0f 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -1,7 +1,7 @@ import unittest from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\ QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\ - StdIOBasedTestCase, FileUpload, McqTestCase, AssignmentUpload + StdIOBasedTestCase, FileUpload, McqTestCase, AssignmentUpload import json import ruamel.yaml as yaml from datetime import datetime, timedelta @@ -160,7 +160,9 @@ class QuestionTestCases(unittest.TestCase): "language": "Python", "type": "Code", "testcase": self.test_case_upload_data, "files": [[file1, 0]], - "summary": "Yaml Demo"}] + "summary": "Yaml Demo", + "tags": ['yaml_demo'] + }] self.yaml_questions_data = yaml.safe_dump_all(questions_data) def tearDown(self): diff --git a/yaksh/test_views.py b/yaksh/test_views.py index e5308fc..0060ed8 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -3012,12 +3012,18 @@ class TestShowQuestions(TestCase): data={'file': questions_file, 'upload': 'upload'} ) + summaries = ['Roots of quadratic equation', 'Print Output', + 'Adding decimals', 'For Loop over String', + 'Hello World in File', 'Extract columns from files', + 'Check Palindrome', 'Add 3 numbers', 'Reverse a string' + ] + uploaded_ques = Question.objects.filter(active=True, - summary="Yaksh Demo Question", + summary__in=summaries, user=self.user).count() self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'yaksh/showquestions.html') - self.assertEqual(uploaded_ques, 3) + self.assertEqual(uploaded_ques, 9) f.close() dummy_file = SimpleUploadedFile("test.txt", b"test") response = self.client.post(reverse('yaksh:show_questions'), |