summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-02-28 13:43:48 +0530
committerGitHub2020-02-28 13:43:48 +0530
commitce0cdc307312d4da803abb3377cf7562b3fbcb4b (patch)
treeb1303ee3214c0e1ff0581d9ce96495c7efde6cd7 /yaksh/test_models.py
parent32f1d4dc7816bbb93f6dda77591eeb75c3f30c0d (diff)
parentb4751e0c1783a71c6672554114ccdf5a78c6b47f (diff)
downloadonline_test-ce0cdc307312d4da803abb3377cf7562b3fbcb4b.tar.gz
online_test-ce0cdc307312d4da803abb3377cf7562b3fbcb4b.tar.bz2
online_test-ce0cdc307312d4da803abb3377cf7562b3fbcb4b.zip
Merge pull request #652 from adityacp/revamp_ui
Revamp UI in moderator and student dashboard
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py40
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):