Sources apps test updates
Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -7,6 +7,13 @@ from .literals import TEST_SOURCE_LABEL, TEST_SOURCE_UNCOMPRESS_N
|
|||||||
|
|
||||||
|
|
||||||
class SourceTestMixin(object):
|
class SourceTestMixin(object):
|
||||||
|
auto_create_test_source = True
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(SourceTestMixin, self).setUp()
|
||||||
|
if self.auto_create_test_source:
|
||||||
|
self._create_test_source()
|
||||||
|
|
||||||
def _create_test_source(self):
|
def _create_test_source(self):
|
||||||
self.test_source = WebFormSource.objects.create(
|
self.test_source = WebFormSource.objects.create(
|
||||||
enabled=True, label=TEST_SOURCE_LABEL,
|
enabled=True, label=TEST_SOURCE_LABEL,
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class CompressedUploadsTestCase(SourceTestMixin, GenericDocumentTestCase):
|
|||||||
auto_upload_document = False
|
auto_upload_document = False
|
||||||
|
|
||||||
def test_upload_compressed_file(self):
|
def test_upload_compressed_file(self):
|
||||||
self._create_test_source()
|
|
||||||
self.test_source.uncompress = SOURCE_UNCOMPRESS_CHOICE_Y
|
self.test_source.uncompress = SOURCE_UNCOMPRESS_CHOICE_Y
|
||||||
self.test_source.save()
|
self.test_source.save()
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,6 @@ class DocumentUploadWizardViewTestCase(
|
|||||||
):
|
):
|
||||||
auto_upload_document = False
|
auto_upload_document = False
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(DocumentUploadWizardViewTestCase, self).setUp()
|
|
||||||
self._create_test_source()
|
|
||||||
|
|
||||||
def test_upload_compressed_file(self):
|
def test_upload_compressed_file(self):
|
||||||
self.test_source.uncompress = SOURCE_UNCOMPRESS_CHOICE_Y
|
self.test_source.uncompress = SOURCE_UNCOMPRESS_CHOICE_Y
|
||||||
self.test_source.save()
|
self.test_source.save()
|
||||||
@@ -300,6 +296,8 @@ class StagingFolderViewTestCase(
|
|||||||
class SourcesViewTestCase(
|
class SourcesViewTestCase(
|
||||||
SourceTestMixin, SourceViewTestMixin, GenericViewTestCase
|
SourceTestMixin, SourceViewTestMixin, GenericViewTestCase
|
||||||
):
|
):
|
||||||
|
auto_create_test_source = False
|
||||||
|
|
||||||
def test_source_create_view_no_permission(self):
|
def test_source_create_view_no_permission(self):
|
||||||
response = self._request_setup_source_create_view()
|
response = self._request_setup_source_create_view()
|
||||||
self.assertEqual(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|||||||
Reference in New Issue
Block a user