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())