diff options
author | adityacp | 2020-02-19 12:13:38 +0530 |
---|---|---|
committer | adityacp | 2020-02-19 12:15:43 +0530 |
commit | fcfd868e44f0c768d05ef0dd58c72e46f9cbee61 (patch) | |
tree | 8909446448aabd1c0ca26807afec4fff9ce0cd3c /yaksh/test_models.py | |
parent | f2d1d8fe76109a5b7c53e68de2bd86230874ba90 (diff) | |
download | online_test-fcfd868e44f0c768d05ef0dd58c72e46f9cbee61.tar.gz online_test-fcfd868e44f0c768d05ef0dd58c72e46f9cbee61.tar.bz2 online_test-fcfd868e44f0c768d05ef0dd58c72e46f9cbee61.zip |
Fix pep style and add test case in test_models
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r-- | yaksh/test_models.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py index 4d91b27..6e5a26d 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -589,6 +589,46 @@ class QuestionTestCases(unittest.TestCase): ) self.assertEqual(msg, "Unable to parse test case data") + def test_get_test_case_options(self): + """ + Test if test case options are selected based on + question type and language + """ + + # Given + question_types = [ + "mcq", "integer", "float", "string", "arrange", "upload" + ] + que_list = [] + for i, q_type in enumerate(question_types, 1): + que_list.append(Question.objects.create( + summary='Python Question {0}'.format(i), language='python', + type=q_type, active=True, + description='{0} Question'.format(q_type), + points=1.0, user=self.user1 + )) + + # When + expected_tc_options = [ + ('standardtestcase', 'Standard TestCase'), + ('stdiobasedtestcase', 'StdIO TestCase'), + ('hooktestcase', 'Hook TestCase') + ] + other_tc_options = [ + ('mcqtestcase', 'Mcq TestCase'), + ('integertestcase', 'Integer TestCase'), + ('floattestcase', 'Float TestCase'), + ('stringtestcase', 'String TestCase'), + ('arrangetestcase', 'Arrange TestCase'), + ('hooktestcase', 'Hook TestCase') + ] + + # Then + obtained_tc_options = self.question2.get_test_case_options() + self.assertEqual(expected_tc_options, obtained_tc_options) + for que, tc_option in zip(que_list, other_tc_options): + self.assertEqual(que.get_test_case_options()[0], tc_option) + ############################################################################### class QuizTestCases(unittest.TestCase): |