From f158bfd1e064e1c7c2107694dd5f789f8b15d05d Mon Sep 17 00:00:00 2001 From: Sidney Richards Date: Thu, 9 Jan 2025 10:13:34 +0100 Subject: [PATCH] Mock callback validation flag should be inverse of DEBUG --- digid_eherkenning/mock/conf.py | 4 +++- tests/test_mock_views.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/digid_eherkenning/mock/conf.py b/digid_eherkenning/mock/conf.py index 85dc7c5..b1396df 100644 --- a/digid_eherkenning/mock/conf.py +++ b/digid_eherkenning/mock/conf.py @@ -52,7 +52,9 @@ def should_validate_idp_callback_urls() -> bool: """ Whether to validate that the `next_url` and `cancel_urls` are safe """ - flag = getattr(settings, "DIGID_MOCK_IDP_VALIDATE_CALLBACK_URLS", settings.DEBUG) + flag = getattr( + settings, "DIGID_MOCK_IDP_VALIDATE_CALLBACK_URLS", not settings.DEBUG + ) if not isinstance(flag, bool): raise ImproperlyConfigured( "DIGID_MOCK_IDP_VALIDATE_CALLBACK_URLS should be a boolean" diff --git a/tests/test_mock_views.py b/tests/test_mock_views.py index a2fe580..9bf3717 100644 --- a/tests/test_mock_views.py +++ b/tests/test_mock_views.py @@ -142,13 +142,13 @@ def test_conf_setting_must_be_a_bool(self): should_validate_idp_callback_urls() @override_settings() - def test_conf_setting_defaults_to_debug_flag(self): + def test_conf_setting_defaults_to_inverse_of_debug_flag(self): del settings.DIGID_MOCK_IDP_VALIDATE_CALLBACK_URLS - with override_settings(DEBUG=True): + with override_settings(DEBUG=False): self.assertTrue(should_validate_idp_callback_urls()) - with override_settings(DEBUG=False): + with override_settings(DEBUG=True): self.assertFalse(should_validate_idp_callback_urls())