Include django-downloadview's assert_download_response as a
BaseTest member. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -14,7 +14,9 @@ from django.views.generic.edit import (
|
||||
)
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
from django_downloadview import VirtualDownloadView, VirtualFile
|
||||
from django_downloadview import (
|
||||
TextIteratorIO, VirtualDownloadView, VirtualFile
|
||||
)
|
||||
from pure_pagination.mixins import PaginationMixin
|
||||
|
||||
from .forms import ChoiceForm
|
||||
@@ -388,6 +390,7 @@ class SingleObjectDetailView(ViewPermissionCheckMixin, ObjectPermissionCheckMixi
|
||||
|
||||
|
||||
class SingleObjectDownloadView(ViewPermissionCheckMixin, ObjectPermissionCheckMixin, VirtualDownloadView, SingleObjectMixin):
|
||||
TextIteratorIO = TextIteratorIO
|
||||
VirtualFile = VirtualFile
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from django_downloadview import assert_download_response
|
||||
|
||||
from permissions.classes import Permission
|
||||
from smart_settings.classes import Namespace
|
||||
|
||||
@@ -14,6 +16,7 @@ class BaseTestCase(ContentTypeCheckMixin, OpenFileCheckMixin, TempfileCheckMixin
|
||||
"""
|
||||
This is the most basic test case class any test in the project should use.
|
||||
"""
|
||||
assert_download_response = assert_download_response
|
||||
|
||||
def setUp(self):
|
||||
super(BaseTestCase, self).setUp()
|
||||
|
||||
@@ -5,8 +5,6 @@ from __future__ import unicode_literals
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import override_settings
|
||||
|
||||
from django_downloadview import assert_download_response
|
||||
|
||||
from common.tests.test_views import GenericViewTestCase
|
||||
from converter.models import Transformation
|
||||
from converter.permissions import permission_transformation_delete
|
||||
@@ -208,7 +206,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
with self.document.open() as file_object:
|
||||
assert_download_response(
|
||||
self.assert_download_response(
|
||||
self, response, content=file_object.read(),
|
||||
basename=TEST_SMALL_DOCUMENT_FILENAME,
|
||||
mime_type=self.document.file_mimetype
|
||||
@@ -238,7 +236,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
with self.document.open() as file_object:
|
||||
assert_download_response(
|
||||
self.assert_download_response(
|
||||
self, response, content=file_object.read(),
|
||||
basename=TEST_SMALL_DOCUMENT_FILENAME,
|
||||
mime_type=self.document.file_mimetype
|
||||
@@ -268,7 +266,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
with self.document.open() as file_object:
|
||||
assert_download_response(
|
||||
self.assert_download_response(
|
||||
self, response, content=file_object.read(),
|
||||
basename='{} - {}'.format(
|
||||
TEST_SMALL_DOCUMENT_FILENAME,
|
||||
|
||||
Reference in New Issue
Block a user