From 3f33bdd9c277be603e7a774c633fc41d3f32fcda Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 11 Oct 2019 10:57:51 -0400 Subject: [PATCH] Sources apps test updates Signed-off-by: Roberto Rosario --- mayan/apps/sources/tests/mixins.py | 7 +++++++ mayan/apps/sources/tests/test_models.py | 1 - mayan/apps/sources/tests/test_views.py | 6 ++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/mayan/apps/sources/tests/mixins.py b/mayan/apps/sources/tests/mixins.py index d849788514..62959d5cfc 100644 --- a/mayan/apps/sources/tests/mixins.py +++ b/mayan/apps/sources/tests/mixins.py @@ -7,6 +7,13 @@ from .literals import TEST_SOURCE_LABEL, TEST_SOURCE_UNCOMPRESS_N 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): self.test_source = WebFormSource.objects.create( enabled=True, label=TEST_SOURCE_LABEL, diff --git a/mayan/apps/sources/tests/test_models.py b/mayan/apps/sources/tests/test_models.py index 8d142f1e9b..188b086931 100644 --- a/mayan/apps/sources/tests/test_models.py +++ b/mayan/apps/sources/tests/test_models.py @@ -39,7 +39,6 @@ class CompressedUploadsTestCase(SourceTestMixin, GenericDocumentTestCase): auto_upload_document = False def test_upload_compressed_file(self): - self._create_test_source() self.test_source.uncompress = SOURCE_UNCOMPRESS_CHOICE_Y self.test_source.save() diff --git a/mayan/apps/sources/tests/test_views.py b/mayan/apps/sources/tests/test_views.py index a5484201f1..da4b9044ba 100644 --- a/mayan/apps/sources/tests/test_views.py +++ b/mayan/apps/sources/tests/test_views.py @@ -54,10 +54,6 @@ class DocumentUploadWizardViewTestCase( ): auto_upload_document = False - def setUp(self): - super(DocumentUploadWizardViewTestCase, self).setUp() - self._create_test_source() - def test_upload_compressed_file(self): self.test_source.uncompress = SOURCE_UNCOMPRESS_CHOICE_Y self.test_source.save() @@ -300,6 +296,8 @@ class StagingFolderViewTestCase( class SourcesViewTestCase( SourceTestMixin, SourceViewTestMixin, GenericViewTestCase ): + auto_create_test_source = False + def test_source_create_view_no_permission(self): response = self._request_setup_source_create_view() self.assertEqual(response.status_code, 403)