summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaheshgudi2018-07-13 16:48:21 +0530
committermaheshgudi2018-07-13 16:48:21 +0530
commit590dc4a5e99fc1f72287d13e5ce25d1506b4e518 (patch)
tree67018aefddc6cd215c1f8f4fce6741dc8b625bfa
parentf3ed3db3f707e358694eee837cde6e7dd8edb241 (diff)
downloadonline_test-590dc4a5e99fc1f72287d13e5ce25d1506b4e518.tar.gz
online_test-590dc4a5e99fc1f72287d13e5ce25d1506b4e518.tar.bz2
online_test-590dc4a5e99fc1f72287d13e5ce25d1506b4e518.zip
Fix unit and selenium tests for simple questions
-rw-r--r--yaksh/live_server_tests/selenium_test.py8
-rw-r--r--yaksh/models.py6
-rw-r--r--yaksh/settings.py2
-rw-r--r--yaksh/test_views.py8
4 files changed, 14 insertions, 10 deletions
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py
index 6351f9e..a067f22 100644
--- a/yaksh/live_server_tests/selenium_test.py
+++ b/yaksh/live_server_tests/selenium_test.py
@@ -118,7 +118,7 @@ class SeleniumTest():
# Correct Answer
loop_count = 1
- answer = '\"#!/bin/bash\\ncat $1 | cut -d: -f2 | paste -d: $3 - $2\"'
+ answer = '\"#!/bin/bash\\necho "Hello, World!"\"'
self.submit_answer(question_label, answer, loop_count)
def open_quiz(self):
@@ -135,9 +135,9 @@ class SeleniumTest():
)
start_exam_elem.click()
- self.test_c_question(question_label=7)
- self.test_python_question(question_label=5)
- self.test_bash_question(question_label=4)
+ self.test_c_question(question_label=6)
+ self.test_python_question(question_label=4)
+ self.test_bash_question(question_label=10)
def quit_quiz(self):
quit_link_elem = WebDriverWait(self.driver, 5).until(
diff --git a/yaksh/models.py b/yaksh/models.py
index f8dac8b..f7adfd8 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1595,9 +1595,11 @@ class QuestionPaper(models.Model):
question_paper = QuestionPaper.objects.create(quiz=demo_quiz,
shuffle_questions=False
)
- summaries = ['Roots of quadratic equation', 'Print Output',
+ summaries = ['Find the value of n', 'Print Output in Python2.x',
'Adding decimals', 'For Loop over String',
- 'Hello World in File', 'Extract columns from files',
+ 'Hello World in File',
+ 'Arrange code to convert km to miles',
+ 'Print Hello, World!', "Square of two numbers",
'Check Palindrome', 'Add 3 numbers', 'Reverse a string'
]
questions = Question.objects.filter(active=True,
diff --git a/yaksh/settings.py b/yaksh/settings.py
index f687d51..9e9597d 100644
--- a/yaksh/settings.py
+++ b/yaksh/settings.py
@@ -16,7 +16,7 @@ SERVER_POOL_PORT = config('SERVER_POOL_PORT', default=55555, cast=int)
SERVER_HOST_NAME = config('SERVER_HOST_NAME', default='http://localhost')
# Timeout for the code to run in seconds. This is an integer!
-SERVER_TIMEOUT = config('SERVER_TIMEOUT', default=6, cast=int)
+SERVER_TIMEOUT = config('SERVER_TIMEOUT', default=4, cast=int)
# The root of the URL, for example you might be in the situation where you
# are not hosted as host.org/exam/ but as host.org/foo/exam/ for whatever
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 899ed31..b71bb3e 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -4384,9 +4384,11 @@ class TestShowQuestions(TestCase):
data={'file': questions_file,
'upload': 'upload'}
)
- summaries = ['Roots of quadratic equation', 'Print Output',
+ summaries = ['Find the value of n', 'Print Output in Python2.x',
'Adding decimals', 'For Loop over String',
- 'Hello World in File', 'Extract columns from files',
+ 'Hello World in File',
+ 'Arrange code to convert km to miles',
+ 'Print Hello, World!', "Square of two numbers",
'Check Palindrome', 'Add 3 numbers', 'Reverse a string'
]
@@ -4395,7 +4397,7 @@ class TestShowQuestions(TestCase):
user=self.user).count()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'yaksh/showquestions.html')
- self.assertEqual(uploaded_ques, 9)
+ self.assertEqual(uploaded_ques, 11)
f.close()
dummy_file = SimpleUploadedFile("test.txt", b"test")
response = self.client.post(