# HG changeset patch # User Johannes Bornhold # Date 2016-06-20 15:27:31 # Node ID b082c123e87e3410cf858e9b2748c55956f5ada4 # Parent 840f51fa5f2bf6e124e5bcde332d66ae10970f41 authn: Test authentication plugin settings POST views. diff --git a/rhodecode/authentication/tests/functional/test_settings.py b/rhodecode/authentication/tests/functional/test_settings.py --- a/rhodecode/authentication/tests/functional/test_settings.py +++ b/rhodecode/authentication/tests/functional/test_settings.py @@ -42,6 +42,19 @@ class TestAuthenticationSettings: response = app.get(url) assert response.status_code == 200 + def test_plugin_settings_view_post(self, app, auth_plugin, csrf_token): + url = '{prefix}/auth/{name}'.format( + prefix=ADMIN_PREFIX, + name=auth_plugin.name) + params = { + 'enabled': True, + 'cache_ttl': 0, + 'csrf_token': csrf_token, + } + with EnabledAuthPlugin(auth_plugin): + response = app.post(url, params=params) + assert response.status_code in [200, 302] + def test_plugin_settings_view_get_404(self, app, auth_plugin): url = '{prefix}/auth/{name}'.format( prefix=ADMIN_PREFIX, @@ -49,3 +62,16 @@ class TestAuthenticationSettings: with DisabledAuthPlugin(auth_plugin): response = app.get(url, status=404) assert response.status_code == 404 + + def test_plugin_settings_view_post_404(self, app, auth_plugin, csrf_token): + url = '{prefix}/auth/{name}'.format( + prefix=ADMIN_PREFIX, + name=auth_plugin.name) + params = { + 'enabled': True, + 'cache_ttl': 0, + 'csrf_token': csrf_token, + } + with DisabledAuthPlugin(auth_plugin): + response = app.post(url, params=params, status=404) + assert response.status_code == 404