summaryrefslogtreecommitdiff
path: root/testapp/exam/tests.py
diff options
context:
space:
mode:
authorankitjavalkar2015-04-20 21:42:02 +0530
committerankitjavalkar2015-04-26 19:46:01 +0530
commit3ffdba6e587422a0f2955879d12e0b2aeac342e1 (patch)
tree7ea9136dc4694b1d534dc2df7f1b0353ed4ee075 /testapp/exam/tests.py
parentcbeffec80d30fe2a9048644f5b0345f797479c92 (diff)
downloadonline_test-3ffdba6e587422a0f2955879d12e0b2aeac342e1.tar.gz
online_test-3ffdba6e587422a0f2955879d12e0b2aeac342e1.tar.bz2
online_test-3ffdba6e587422a0f2955879d12e0b2aeac342e1.zip
Code review - code refactoring as per suggestion
- Add subclasses for different languages - Create seperate modules for different languages - Dynamic selection of subclasses based on language used - Add testcases
Diffstat (limited to 'testapp/exam/tests.py')
-rw-r--r--testapp/exam/tests.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/testapp/exam/tests.py b/testapp/exam/tests.py
index 30afb7e..f73d0e2 100644
--- a/testapp/exam/tests.py
+++ b/testapp/exam/tests.py
@@ -3,7 +3,6 @@ from exam.models import User, Profile, Question, Quiz, QuestionPaper,\
QuestionSet, AnswerPaper, Answer, TestCase
import datetime, json
-
def setUpModule():
# create user profile
user = User.objects.create_user(username='demo_user',
@@ -78,13 +77,6 @@ class QuestionTestCases(unittest.TestCase):
self.answer_data_json = json.dumps(answer_data)
self.user_answer = "demo_answer"
-
-# {"user_answer": "demo_answer",
-# "test_parameter": [{"func_name": "def myfunc",
-# "expected_answer": "15", "test_id": null, "pos_args": ["12", "13"],
-# "kw_args": {"a": "10", "b": "11"}}],
-# "ref_code_path": "", "id": 21, "language": "Python"}
-
def test_question(self):
""" Test question """
self.assertEqual(self.question.summary, 'Demo question')
@@ -94,7 +86,6 @@ class QuestionTestCases(unittest.TestCase):
self.assertEqual(self.question.description, 'Write a function')
self.assertEqual(self.question.points, 1.0)
self.assertTrue(self.question.active)
- # self.assertEqual(self.question.test, 'Test Cases')
self.assertEqual(self.question.snippet, 'def myfunc()')
tag_list = []
for tag in self.question.tags.all():
@@ -104,7 +95,7 @@ class QuestionTestCases(unittest.TestCase):
def test_consolidate_answer_data(self):
""" Test consolidate_answer_data function """
result = self.question.consolidate_answer_data([self.testcase],
- user_answer)
+ self.user_answer)
self.assertEqual(result, self.answer_data_json)