From 8bfaed158c40efee7ed837cb9b50edecad8d3eb8 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 14 Dec 2022 12:01:00 +0100 Subject: Tests: use variable for fixtures paths --- archaeological_operations/tests.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'archaeological_operations/tests.py') diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index a37a824d4..a9fe8760e 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -174,7 +174,7 @@ class ImportTest(object): def init_ope_import(self, filename="MCC-operations-example.csv", sep=","): mcc_operation = ImporterType.objects.get(name="MCC - Opérations") mcc_operation_file = open( - settings.ROOT_PATH + "../archaeological_operations/tests/" + filename, "rb" + settings.LIB_BASE_PATH + "archaeological_operations/tests/" + filename, "rb" ) file_dict = { "imported_file": SimpleUploadedFile( @@ -282,8 +282,8 @@ class ImportTest(object): self.init_ope() mcc_parcel = ImporterType.objects.get(name="MCC - Parcelles") mcc_file = open( - settings.ROOT_PATH - + "../archaeological_operations/tests/MCC-parcelles-example.csv", + settings.LIB_BASE_PATH + + "archaeological_operations/tests/MCC-parcelles-example.csv", "rb", ) file_dict = { @@ -312,7 +312,7 @@ class ImportTest(object): self.init_parcel() mcc = ImporterType.objects.get(name="MCC - UE") mcc_file = open( - settings.ROOT_PATH + "../archaeological_context_records/tests/" + settings.LIB_BASE_PATH + "archaeological_context_records/tests/" "MCC-context-records-example.csv", "rb", ) @@ -767,7 +767,7 @@ class ImportDocumentTest(ImportTest, TestCase): ) doc_import_file = open( - settings.ROOT_PATH + "../archaeological_operations/tests/" + filename, "rb" + settings.LIB_BASE_PATH + "archaeological_operations/tests/" + filename, "rb" ) file_dict = { @@ -3374,7 +3374,7 @@ class LabelTest(TestCase, OperationInitTest): ope.save() tpl = open( - settings.ROOT_PATH + "../archaeological_operations/tests/labels-8.odt", "rb" + settings.LIB_BASE_PATH + "archaeological_operations/tests/labels-8.odt", "rb" ) template = SimpleUploadedFile(tpl.name, tpl.read()) model, __ = ImporterModel.objects.get_or_create( @@ -3454,8 +3454,8 @@ class RegisterTest(TestCase, OperationInitTest): def test_document_generation(self): tpl = open( - settings.ROOT_PATH - + "../archaeological_operations/tests/document_reference.odt", + settings.LIB_BASE_PATH + + "archaeological_operations/tests/document_reference.odt", "rb", ) template = SimpleUploadedFile(tpl.name, tpl.read()) @@ -4532,7 +4532,7 @@ class ApiTest(OperationInitTest, APITestCase): return src def _mock_request(self, mock_get, json_file="external_source_types_1.json"): - json_file = "../archaeological_operations/tests/" + json_file + json_file = settings.LIB_BASE_PATH + "archaeological_operations/tests/" + json_file mock_get.return_value.status_code = 200 def __json(): @@ -4682,7 +4682,7 @@ class ApiTest(OperationInitTest, APITestCase): self.client.post(url, params, follow=True) base = "default-source.ods" - filename = settings.ROOT_PATH + "../archaeological_operations/tests/" + base + filename = settings.LIB_BASE_PATH + "archaeological_operations/tests/" + base with open(filename, "rb") as fle: source.match_document.save(base, DjangoFile(fle)) -- cgit v1.2.3