summaryrefslogtreecommitdiff
path: root/yaksh/test_views.py
diff options
context:
space:
mode:
authormahesh2017-11-10 03:20:58 +0530
committermahesh2017-11-10 03:20:58 +0530
commita3b8e78fec5ab542675ca99949b2810e95536c21 (patch)
treea2df4edf6bbf91dac70a8940cb4ca1e405e25ccc /yaksh/test_views.py
parent0bb6a4984d1e97c50a4e8da9394798c4c9a1e589 (diff)
parentcfcb2ed39c724639fe17338e29e327d08ae641b2 (diff)
downloadonline_test-a3b8e78fec5ab542675ca99949b2810e95536c21.tar.gz
online_test-a3b8e78fec5ab542675ca99949b2810e95536c21.tar.bz2
online_test-a3b8e78fec5ab542675ca99949b2810e95536c21.zip
Merge branch 'master' of https://github.com/fossee/online_test into beautify_assertions
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r--yaksh/test_views.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 0950785..652f44c 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -23,7 +23,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\
QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\
AssignmentUpload, FileUpload, McqTestCase, IntegerTestCase, StringTestCase,\
- FloatTestCase
+ FloatTestCase, FIXTURES_DIR_PATH
from yaksh.decorators import user_has_profile
@@ -2936,6 +2936,7 @@ class TestDownloadcsv(TestCase):
self.mod_group.user_set.add(self.user)
self.course = Course.objects.create(name="Python Course",
enrollment="Enroll Request", creator=self.user)
+ self.course.students.add(self.student)
self.quiz = Quiz.objects.create(
start_date_time=datetime(2014, 10, 9, 10, 8, 15, 0, tzone),
@@ -2988,8 +2989,9 @@ class TestDownloadcsv(TestCase):
username=self.student.username,
password=self.student_plaintext_pass
)
- response = self.client.get(reverse('yaksh:download_csv',
- kwargs={"questionpaper_id": self.question_paper.id}),
+ response = self.client.get(reverse('yaksh:download_quiz_csv',
+ kwargs={"course_id": self.course.id,
+ "quiz_id": self.quiz.id}),
follow=True
)
self.assertEqual(response.status_code, 404)
@@ -3017,8 +3019,9 @@ class TestDownloadcsv(TestCase):
username=self.student.username,
password=self.student_plaintext_pass
)
- response = self.client.get(reverse('yaksh:download_csv',
- kwargs={"questionpaper_id": self.question_paper.id}),
+ response = self.client.get(reverse('yaksh:download_quiz_csv',
+ kwargs={"course_id": self.course.id,
+ "quiz_id": self.quiz.id}),
follow=True
)
self.assertEqual(response.status_code, 404)
@@ -3063,11 +3066,14 @@ class TestDownloadcsv(TestCase):
username=self.user.username,
password=self.user_plaintext_pass
)
- response = self.client.get(reverse('yaksh:download_csv',
- kwargs={'questionpaper_id': self.question_paper.id}),
+ response = self.client.get(reverse('yaksh:download_quiz_csv',
+ kwargs={"course_id": self.course.id,
+ "quiz_id": self.quiz.id}),
+
follow=True
)
- file_name = "{0}.csv".format(self.quiz.description)
+ file_name = "{0}-{1}-attempt{2}.csv".format(self.course.name.replace('.', ''),
+ self.quiz.description.replace('.', ''), 1)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.get('Content-Disposition'),
'attachment; filename="{0}"'.format(file_name))
@@ -3195,7 +3201,7 @@ class TestShowQuestions(TestCase):
username=self.user.username,
password=self.user_plaintext_pass
)
- ques_file = os.path.join(settings.FIXTURE_DIRS, "demo_questions.zip")
+ ques_file = os.path.join(FIXTURES_DIR_PATH, "demo_questions.zip")
f = open(ques_file, 'rb')
questions_file = SimpleUploadedFile(ques_file, f.read(),
content_type="application/zip")