diff --git a/mayan/apps/acls/tests/test_models.py b/mayan/apps/acls/tests/test_models.py index 0a9e399ec1..571350452c 100644 --- a/mayan/apps/acls/tests/test_models.py +++ b/mayan/apps/acls/tests/test_models.py @@ -3,7 +3,6 @@ from __future__ import absolute_import, unicode_literals from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.core.exceptions import PermissionDenied -from django.core.files import File from django.test import TestCase, override_settings from documents.models import Document, DocumentType @@ -32,17 +31,17 @@ class PermissionTestCase(TestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document_1 = self.document_type_1.new_document( - file_object=File(file_object) + file_object=file_object ) with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document_2 = self.document_type_1.new_document( - file_object=File(file_object) + file_object=file_object ) with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document_3 = self.document_type_2.new_document( - file_object=File(file_object) + file_object=file_object ) self.user = get_user_model().objects.create( diff --git a/mayan/apps/checkouts/tests/test_models.py b/mayan/apps/checkouts/tests/test_models.py index 757e492135..74a5b256a3 100644 --- a/mayan/apps/checkouts/tests/test_models.py +++ b/mayan/apps/checkouts/tests/test_models.py @@ -4,7 +4,6 @@ import datetime import time from django.contrib.auth import get_user_model -from django.core.files import File from django.test import TestCase, override_settings from django.utils.timezone import now @@ -35,7 +34,7 @@ class DocumentCheckoutTestCase(TestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object) + file_object=file_object ) def tearDown(self): @@ -66,7 +65,7 @@ class DocumentCheckoutTestCase(TestCase): with self.assertRaises(NewDocumentVersionNotAllowed): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: - self.document.new_version(file_object=File(file_object)) + self.document.new_version(file_object=file_object) def test_checkin_in(self): expiration_datetime = now() + datetime.timedelta(days=1) diff --git a/mayan/apps/document_states/tests/test_views.py b/mayan/apps/document_states/tests/test_views.py index 283ba7833d..028818247d 100644 --- a/mayan/apps/document_states/tests/test_views.py +++ b/mayan/apps/document_states/tests/test_views.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.contrib.auth import get_user_model -from django.core.files import File from django.core.urlresolvers import reverse from django.test.client import Client from django.test import TestCase @@ -43,7 +42,7 @@ class DocumentStateViewTestCase(TestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object) + file_object=file_object ) def tearDown(self): diff --git a/mayan/apps/documents/tests/test_api.py b/mayan/apps/documents/tests/test_api.py index 6763518c05..c258b04b37 100644 --- a/mayan/apps/documents/tests/test_api.py +++ b/mayan/apps/documents/tests/test_api.py @@ -8,7 +8,6 @@ from json import loads from django.contrib.auth import get_user_model -from django.core.files import File from django.core.urlresolvers import reverse from django.test import override_settings from django.utils.six import BytesIO @@ -152,7 +151,7 @@ class DocumentAPITestCase(APITestCase): def test_document_move_to_trash(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) self.client.delete( @@ -165,7 +164,7 @@ class DocumentAPITestCase(APITestCase): def test_deleted_document_delete_from_trash(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) document.delete() @@ -182,7 +181,7 @@ class DocumentAPITestCase(APITestCase): def test_deleted_document_restore(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) document.delete() @@ -197,7 +196,7 @@ class DocumentAPITestCase(APITestCase): def test_document_new_version_upload(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) # Artifical delay since MySQL doesn't store microsecond data in @@ -230,14 +229,14 @@ class DocumentAPITestCase(APITestCase): def test_document_version_revert(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) # Needed by MySQL as milliseconds value is not store in timestamp field time.sleep(1) with open(TEST_DOCUMENT_PATH) as file_object: - document.new_version(file_object=File(file_object)) + document.new_version(file_object=file_object) self.assertEqual(document.versions.count(), 2) @@ -256,7 +255,7 @@ class DocumentAPITestCase(APITestCase): def test_document_download(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) response = self.client.get( @@ -276,7 +275,7 @@ class DocumentAPITestCase(APITestCase): def test_document_version_download(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) response = self.client.get( diff --git a/mayan/apps/documents/tests/test_links.py b/mayan/apps/documents/tests/test_links.py index 44e168ee90..3cf8e04445 100644 --- a/mayan/apps/documents/tests/test_links.py +++ b/mayan/apps/documents/tests/test_links.py @@ -4,7 +4,6 @@ from __future__ import unicode_literals import time -from django.core.files import File from django.core.urlresolvers import reverse from acls.models import AccessControlList @@ -26,7 +25,7 @@ from .test_views import GenericDocumentViewTestCase class DocumentsLinksTestCase(GenericDocumentViewTestCase): def test_document_version_revert_link_no_permission(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: - self.document.new_version(file_object=File(file_object)) + self.document.new_version(file_object=file_object) self.assertTrue(self.document.versions.count(), 2) @@ -44,7 +43,7 @@ class DocumentsLinksTestCase(GenericDocumentViewTestCase): time.sleep(2) with open(TEST_SMALL_DOCUMENT_PATH) as file_object: - self.document.new_version(file_object=File(file_object)) + self.document.new_version(file_object=file_object) self.assertTrue(self.document.versions.count(), 2) diff --git a/mayan/apps/documents/tests/test_models.py b/mayan/apps/documents/tests/test_models.py index 52945f03f1..c8ec1d737e 100644 --- a/mayan/apps/documents/tests/test_models.py +++ b/mayan/apps/documents/tests/test_models.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals from datetime import timedelta import time -from django.core.files import File from django.test import TestCase, override_settings from ..exceptions import NewDocumentVersionNotAllowed @@ -25,7 +24,7 @@ class DocumentTestCase(TestCase): with open(TEST_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object), label='mayan_11_1.pdf' + file_object=file_object, label='mayan_11_1.pdf' ) def tearDown(self): @@ -48,11 +47,11 @@ class DocumentTestCase(TestCase): def test_version_creation(self): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: - self.document.new_version(file_object=File(file_object)) + self.document.new_version(file_object=file_object) with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document.new_version( - file_object=File(file_object), comment='test comment 1' + file_object=file_object, comment='test comment 1' ) self.assertEqual(self.document.versions.count(), 3) @@ -144,7 +143,7 @@ class OfficeDocumentTestCase(TestCase): with open(TEST_OFFICE_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object) + file_object=file_object ) def tearDown(self): @@ -171,7 +170,7 @@ class MultiPageTiffTestCase(TestCase): with open(TEST_MULTI_PAGE_TIFF_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object) + file_object=file_object ) def tearDown(self): @@ -196,7 +195,7 @@ class DocumentVersionTestCase(TestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object) + file_object=file_object ) def tearDown(self): @@ -207,7 +206,7 @@ class DocumentVersionTestCase(TestCase): with open(TEST_DOCUMENT_PATH) as file_object: self.document.new_version( - file_object=File(file_object) + file_object=file_object ) self.assertEqual(self.document.versions.count(), 2) @@ -226,7 +225,7 @@ class DocumentVersionTestCase(TestCase): with open(TEST_DOCUMENT_PATH) as file_object: self.document.new_version( - file_object=File(file_object) + file_object=file_object ) self.assertEqual(self.document.versions.count(), 2) @@ -274,7 +273,7 @@ class NewVersionBlockTestCase(TestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object) + file_object=file_object ) def tearDown(self): @@ -314,4 +313,4 @@ class NewVersionBlockTestCase(TestCase): with self.assertRaises(NewDocumentVersionNotAllowed): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: - self.document.new_version(file_object=File(file_object)) + self.document.new_version(file_object=file_object) diff --git a/mayan/apps/documents/tests/test_views.py b/mayan/apps/documents/tests/test_views.py index 3b5c0e2aa3..0b8e10c166 100644 --- a/mayan/apps/documents/tests/test_views.py +++ b/mayan/apps/documents/tests/test_views.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals from django.contrib.contenttypes.models import ContentType -from django.core.files import File from django.test import override_settings from django.utils.six import BytesIO @@ -49,7 +48,7 @@ class GenericDocumentViewTestCase(GenericViewTestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object), label='mayan_11_1.pdf' + file_object=file_object, label='mayan_11_1.pdf' ) def tearDown(self): diff --git a/mayan/apps/dynamic_search/tests/test_api.py b/mayan/apps/dynamic_search/tests/test_api.py index df087c2178..d218757736 100644 --- a/mayan/apps/dynamic_search/tests/test_api.py +++ b/mayan/apps/dynamic_search/tests/test_api.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals from json import loads from django.contrib.auth import get_user_model -from django.core.files import File from django.core.urlresolvers import reverse from django.test import override_settings @@ -39,7 +38,7 @@ class SearchAPITestCase(APITestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) response = self.client.get( diff --git a/mayan/apps/dynamic_search/tests/test_models.py b/mayan/apps/dynamic_search/tests/test_models.py index 559f9ae697..5c9d1bb0f0 100644 --- a/mayan/apps/dynamic_search/tests/test_models.py +++ b/mayan/apps/dynamic_search/tests/test_models.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.contrib.auth import get_user_model -from django.core.files.base import File from django.test import TestCase from documents.models import DocumentType @@ -24,7 +23,7 @@ class DocumentSearchTestCase(TestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object), label='mayan_11_1.pdf' + file_object=file_object, label='mayan_11_1.pdf' ) def tearDown(self): diff --git a/mayan/apps/dynamic_search/tests/test_views.py b/mayan/apps/dynamic_search/tests/test_views.py index b6640e170b..38f756027d 100644 --- a/mayan/apps/dynamic_search/tests/test_views.py +++ b/mayan/apps/dynamic_search/tests/test_views.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.contrib.auth import get_user_model -from django.core.files.base import File from django.core.urlresolvers import reverse from django.test import TestCase from django.test.client import Client @@ -42,7 +41,7 @@ class Issue46TestCase(TestCase): for i in range(self.document_count): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, label='test document', ) diff --git a/mayan/apps/folders/tests/test_api.py b/mayan/apps/folders/tests/test_api.py index 039e41e619..1e7180b1fb 100644 --- a/mayan/apps/folders/tests/test_api.py +++ b/mayan/apps/folders/tests/test_api.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.contrib.auth import get_user_model -from django.core.files import File from django.core.urlresolvers import reverse from django.test import override_settings @@ -77,7 +76,7 @@ class FolderAPITestCase(APITestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) self.client.post( @@ -97,7 +96,7 @@ class FolderAPITestCase(APITestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) folder.documents.add(document) diff --git a/mayan/apps/folders/tests/test_models.py b/mayan/apps/folders/tests/test_models.py index 6889fe6154..ca4682f94d 100644 --- a/mayan/apps/folders/tests/test_models.py +++ b/mayan/apps/folders/tests/test_models.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.contrib.auth import get_user_model -from django.core.files.base import File from django.test import TestCase from documents.models import DocumentType @@ -23,7 +22,7 @@ class FolderTestCase(TestCase): with open(TEST_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object) + file_object=file_object ) self.user = get_user_model().objects.create_superuser( diff --git a/mayan/apps/ocr/tests/test_api.py b/mayan/apps/ocr/tests/test_api.py index 76044ce15f..1194a76748 100644 --- a/mayan/apps/ocr/tests/test_api.py +++ b/mayan/apps/ocr/tests/test_api.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import json from django.contrib.auth import get_user_model -from django.core.files import File from django.core.urlresolvers import reverse from rest_framework import status @@ -37,7 +36,7 @@ class OCRAPITestCase(APITestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document = self.document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) def tearDown(self): diff --git a/mayan/apps/tags/tests/test_api.py b/mayan/apps/tags/tests/test_api.py index aafa4e65f4..ca0950918c 100644 --- a/mayan/apps/tags/tests/test_api.py +++ b/mayan/apps/tags/tests/test_api.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.contrib.auth import get_user_model -from django.core.files import File from django.core.urlresolvers import reverse from django.test import override_settings @@ -89,7 +88,7 @@ class TagAPITestCase(APITestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) self.client.post( @@ -109,7 +108,7 @@ class TagAPITestCase(APITestCase): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: document = document_type.new_document( - file_object=File(file_object), + file_object=file_object, ) tag.documents.add(document)