From 03788a670cccaa6a68efc25ef35e7c6ff29b2f37 Mon Sep 17 00:00:00 2001 From: Tim van Oostrom Date: Mon, 20 Nov 2023 09:32:32 +0100 Subject: [PATCH] Add Feature toggle test + Change value (#58) --- app/config.py | 2 +- app/test_zorgned_service.py | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/config.py b/app/config.py index 57849c3..de2a592 100644 --- a/app/config.py +++ b/app/config.py @@ -31,7 +31,7 @@ ZORGNED_GEMEENTE_CODE = "0363" ZORGNED_API_TOKEN = os.getenv("ZORGNED_API_TOKEN", os.getenv("WMO_NED_API_TOKEN")) ZORGNED_API_URL = os.getenv("ZORGNED_API_URL") -ZORGNED_DOCUMENT_ATTACHMENTS_ACTIVE = True +ZORGNED_DOCUMENT_ATTACHMENTS_ACTIVE = False WMONED_FERNET_ENCRYPTION_KEY = os.getenv("FERNET_KEY") diff --git a/app/test_zorgned_service.py b/app/test_zorgned_service.py index b9a5b0e..c65125e 100644 --- a/app/test_zorgned_service.py +++ b/app/test_zorgned_service.py @@ -329,6 +329,13 @@ def test_format_aanvragen(self, encrypt_mock): source1_formatted = format_aanvragen(source1) + document = { + "id": id_encrypted_mock, + "title": "WRV rapport", + "url": f"/wmoned/document/{id_encrypted_mock}", + "datePublished": "2021-03-31T15:28:05", + } + aanvraag1 = { "title": "autozitje", "itemTypeCode": "OVE", @@ -341,14 +348,7 @@ def test_format_aanvragen(self, encrypt_mock): "serviceOrderDate": "2017-05-01", "serviceDateStart": "2017-06-01", "serviceDateEnd": "2018-02-23", - "documents": [ - { - "id": id_encrypted_mock, - "title": "WRV rapport", - "url": f"/wmoned/document/{id_encrypted_mock}", - "datePublished": "2021-03-31T15:28:05", - } - ], + "documents": None, } aanvraag2 = { @@ -363,16 +363,15 @@ def test_format_aanvragen(self, encrypt_mock): "serviceOrderDate": "2017-05-01", "serviceDateStart": "2017-06-01", "serviceDateEnd": "2018-02-23", - "documents": [ - { - "id": id_encrypted_mock, - "title": "WRV rapport", - "url": f"/wmoned/document/{id_encrypted_mock}", - "datePublished": "2021-03-31T15:28:05", - } - ], + "documents": None, } + self.maxDiff = None + + if config.ZORGNED_DOCUMENT_ATTACHMENTS_ACTIVE: + aanvraag1["documents"] = [document] + aanvraag2["documents"] = [document] + self.assertEqual(len(source1_formatted), 2) self.assertEqual(source1_formatted, [aanvraag1, aanvraag2])