Exemplo n.º 1
0
    def test_prepare_file_twice(self):
        # Prepare 1st file
        self.client.post(self.prepare_url)
        file_path1 = tasks_api.get_file_path(self.course.id)
        last_file_date1 = tasks_api.get_last_file_date(self.course.id)
        self.assertTrue(os.path.exists(file_path1))

        # Prepare 2nd file
        self.client.post(self.prepare_url)
        file_path2 = tasks_api.get_file_path(self.course.id)
        last_file_date2 = tasks_api.get_last_file_date(self.course.id)
        self.assertFalse(os.path.exists(file_path1))
        self.assertTrue(os.path.exists(file_path2))
        self.assertLess(last_file_date1, last_file_date2)
Exemplo n.º 2
0
    def test_download_file_without_preparation(self):
        is_prepared = tasks_api.file_is_prepared(self.course.id)
        last_file_date = tasks_api.get_last_file_date(self.course.id)
        response = self.client.get(self.download_url)

        self.assertFalse(is_prepared)
        self.assertIsNone(last_file_date)
        self.assertEqual(404, response.status_code)