summaryrefslogtreecommitdiff
path: root/yaksh/test_views.py
diff options
context:
space:
mode:
authorankitjavalkar2020-06-09 11:09:07 +0530
committerankitjavalkar2020-06-09 16:04:43 +0530
commitdb974d80d0ec308d17c6c0099576d24f3e0ed98a (patch)
tree1b6a0bd602991f3ae17af2790cfc66372580929e /yaksh/test_views.py
parentfe70769afcdf239577d59e330e32306d14107a48 (diff)
downloadonline_test-db974d80d0ec308d17c6c0099576d24f3e0ed98a.tar.gz
online_test-db974d80d0ec308d17c6c0099576d24f3e0ed98a.tar.bz2
online_test-db974d80d0ec308d17c6c0099576d24f3e0ed98a.zip
Fix test cases
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r--yaksh/test_views.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index a7ccac2..3a42cf5 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -2166,7 +2166,8 @@ class TestCourses(TestCase):
# Teacher Login
# Given
# Add files to a lesson
- lesson_file = SimpleUploadedFile("file1.txt", b"Test")
+ file_content = b"Test"
+ lesson_file = SimpleUploadedFile("file1.txt", file_content)
django_file = File(lesson_file)
lesson_file_obj = LessonFile()
lesson_file_obj.lesson = self.lesson
@@ -2201,18 +2202,18 @@ class TestCourses(TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(courses.last().creator, self.teacher)
self.assertEqual(courses.last().name, "Copy Of Python Course")
- self.assertEqual(module.name, "Copy of demo module")
+ self.assertEqual(module.name, "demo module")
self.assertEqual(module.creator, self.teacher)
self.assertEqual(module.order, 0)
self.assertEqual(len(units), 2)
- self.assertEqual(cloned_lesson.name, "Copy of demo lesson")
+ self.assertEqual(cloned_lesson.name, "demo lesson")
self.assertEqual(cloned_lesson.creator, self.teacher)
- self.assertEqual(cloned_quiz.description, "Copy of demo quiz")
+ self.assertEqual(cloned_quiz.description, "demo quiz")
self.assertEqual(cloned_quiz.creator, self.teacher)
self.assertEqual(cloned_qp.__str__(),
- "Question Paper for Copy of demo quiz")
- self.assertEqual(os.path.basename(expected_lesson_files[0].file.name),
- os.path.basename(actual_lesson_files[0].file.name))
+ "Question Paper for demo quiz")
+ self.assertTrue(expected_lesson_files.exists())
+ self.assertEquals(expected_lesson_files[0].file.read(), file_content)
for lesson_file in self.all_files:
file_path = lesson_file.file.path