summaryrefslogtreecommitdiff
path: root/yaksh/tests
diff options
context:
space:
mode:
authormaheshgudi2018-04-06 15:07:26 +0530
committermaheshgudi2018-04-06 16:20:10 +0530
commit97e6372b344f02c541e443afde5ba468506bccd8 (patch)
treea9e929c6cc397e6c501507810d46ec607d966d35 /yaksh/tests
parent895102248fedae4dded163bfc8db0bb452f5bb6c (diff)
downloadonline_test-97e6372b344f02c541e443afde5ba468506bccd8.tar.gz
online_test-97e6372b344f02c541e443afde5ba468506bccd8.tar.bz2
online_test-97e6372b344f02c541e443afde5ba468506bccd8.zip
Fix a bug that allows answer to be true if there are no test cases to a code question
Diffstat (limited to 'yaksh/tests')
-rw-r--r--yaksh/tests/test_code_server.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/yaksh/tests/test_code_server.py b/yaksh/tests/test_code_server.py
index 1309624..a647481 100644
--- a/yaksh/tests/test_code_server.py
+++ b/yaksh/tests/test_code_server.py
@@ -106,6 +106,25 @@ class TestCodeServer(unittest.TestCase):
self.assertFalse(data['success'])
self.assertTrue('AssertionError' in data['error'][0]['exception'])
+ def test_question_with_no_testcases(self):
+ # Given
+ testdata = {
+ 'metadata': {
+ 'user_answer': 'def f(): return 1',
+ 'language': 'python',
+ 'partial_grading': False
+ },
+ 'test_case_data': []
+ }
+
+ # When
+ submit(self.url, '0', json.dumps(testdata), '')
+ result = get_result(self.url, '0', block=True)
+
+ # Then
+ data = json.loads(result.get('result'))
+ self.assertFalse(data['success'])
+
def test_multiple_simultaneous_hits(self):
# Given
results = Queue()