diff options
author | adityacp | 2018-07-10 16:39:26 +0530 |
---|---|---|
committer | adityacp | 2018-07-10 16:39:26 +0530 |
commit | 7b268a2daf288fec1163d7f2322c4eb7575da78d (patch) | |
tree | 632516d81fedeaaddb7e18bed42c8b39d61ec44a /yaksh/test_views.py | |
parent | c075bc00bc57507f2af4d47f7f2e5e063df6921a (diff) | |
download | online_test-7b268a2daf288fec1163d7f2322c4eb7575da78d.tar.gz online_test-7b268a2daf288fec1163d7f2322c4eb7575da78d.tar.bz2 online_test-7b268a2daf288fec1163d7f2322c4eb7575da78d.zip |
Imporve download course offline views test to check files inside zip file
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r-- | yaksh/test_views.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index c1511c0..e691140 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -2049,9 +2049,18 @@ class TestCourses(TestCase): ) course_name = self.user1_course.name.replace(" ", "_") self.assertEqual(response.status_code, 200) - self.assertEqual(response.get('Content-Disposition'), - 'attachment; filename={0}.zip'.format(course_name) - ) + zip_file = string_io(response.content) + zipped_file = zipfile.ZipFile(zip_file, 'r') + self.assertIsNone(zipped_file.testzip()) + files_in_zip = zipped_file.namelist() + module_path = os.path.join(course_name, "demo_module", + "demo_module.html") + lesson_path = os.path.join(course_name, "demo_module", "demo_lesson", + "demo_lesson.html") + self.assertIn(module_path, files_in_zip) + self.assertIn(lesson_path, files_in_zip) + zip_file.close() + zipped_file.close() self.user1_course.learning_module.remove(self.learning_module1) |