Mercurial > kallithea
changeset 5335:8ccc02375c0d
tests: basic tests that the pam and crowd auth modules can be enabled
Will at least give a minimal check for syntax errors ...
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 31 Jul 2015 15:44:07 +0200 |
parents | d8918bb94b80 |
children | caaf0d07c168 |
files | kallithea/tests/functional/test_admin_auth_settings.py |
diffstat | 1 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/functional/test_admin_auth_settings.py Fri Jul 31 15:44:07 2015 +0200 +++ b/kallithea/tests/functional/test_admin_auth_settings.py Fri Jul 31 15:44:07 2015 +0200 @@ -187,3 +187,43 @@ extra_environ={'REMOTE_USER': 'john'}, ) self.assertNotIn('Log Out', response.normal_body) + + def test_crowd_save_settings(self): + self.log_user() + + params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_crowd') + params.update({'auth_crowd_host': ' hostname ', + 'auth_crowd_app_password': 'secret', + 'auth_crowd_admin_groups': 'mygroup', + 'auth_crowd_port': '123', + 'auth_crowd_app_name': 'xyzzy'}) + + test_url = url(controller='admin/auth_settings', + action='auth_settings') + + response = self.app.post(url=test_url, params=params) + self.checkSessionFlash(response, 'Auth settings updated successfully') + + new_settings = Setting.get_auth_settings() + self.assertEqual(new_settings['auth_crowd_host'], u'hostname', + 'fail db write compare') + + def test_pam_save_settings(self): + self.log_user() + + if not pam_lib_installed: + raise SkipTest('skipping due to missing pam lib') + + params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_pam') + params.update({'auth_pam_service': 'kallithea', + 'auth_pam_gecos': '^foo-.*'}) + + test_url = url(controller='admin/auth_settings', + action='auth_settings') + + response = self.app.post(url=test_url, params=params) + self.checkSessionFlash(response, 'Auth settings updated successfully') + + new_settings = Setting.get_auth_settings() + self.assertEqual(new_settings['auth_pam_service'], u'kallithea', + 'fail db write compare')