def test_url_respects_feature_flag_on(settings): # given the feature is turned off settings.FEATURE_FLAG_ONLY_ALLOW_SIEL = False reload_urlconf(["exporter.compliance.urls", settings.ROOT_URLCONF]) # when urls are looked up # then nothing bad happens lookup_urls()
def test_url_respects_feature_flag_off(settings): # given the feature is turned on settings.FEATURE_FLAG_ONLY_ALLOW_SIEL = True reload_urlconf(["exporter.compliance.urls", settings.ROOT_URLCONF]) # when urls are looked up # but non SIEL urls are not found with pytest.raises(NoReverseMatch): lookup_urls()
def test_feature_flag_on(settings, authorized_client, mock_gov_user): # given the feature flag is enabled settings.FEATURE_SPIRE_SEARCH_ON = True reload_urlconf() # when the spire page is requested response = authorized_client.get(reverse("spire:application-search")) # then it will be served assert response.status_code == 200
def test_feature_flag_off(settings, client, user): # enabling the feature to allow generating the url settings.FEATURE_SPIRE_SEARCH_ON = True reload_urlconf() url = reverse("spire:application-search") # given the feature flag is disabled settings.FEATURE_SPIRE_SEARCH_ON = False reload_urlconf() # when the spire page is requested response = client.get(url) # then it will not be served assert response.status_code == 404
def test_url_respects_feature_flag_on(settings): # given the feature is not turned on settings.FEATURE_FLAG_ONLY_ALLOW_SIEL = False reload_urlconf( ["exporter.apply_for_a_licence.urls", settings.ROOT_URLCONF]) # when urls are looked up # then SIEL and start url are found reverse("apply_for_a_licence:start") reverse("apply_for_a_licence:export_licence_questions") # and non SIEL urls are not found reverse("apply_for_a_licence:trade_control_licence_questions") reverse("apply_for_a_licence:transhipment_questions") reverse("apply_for_a_licence:mod_questions") reverse("apply_for_a_licence:ogl_questions", kwargs={"ogl": "foo"}) reverse("apply_for_a_licence:ogl_submit", kwargs={ "ogl": "foo", "pk": uuid4() })