Files
@ c78de39f30fc
Branch filter:
Location: kallithea/rhodecode/tests/functional/test_admin_ldap_settings.py - annotation
c78de39f30fc
3.0 KiB
text/x-python
summary: redirect from repo URLs with #branchname to changelog with this branch
This implements partial support for the Mercurial syntax for specifying
revisions so https://secure.rhodecode.org/rhodecode/#beta works both for
pulling with Mercurial and browsing.
This uses javascript, and has a bit of extra support for onhashchange in HTML5 browsers.
This implements partial support for the Mercurial syntax for specifying
revisions so https://secure.rhodecode.org/rhodecode/#beta works both for
pulling with Mercurial and browsing.
This uses javascript, and has a bit of extra support for onhashchange in HTML5 browsers.
4bdcc08b04c4 2c0d35e336b5 3dedf3991d40 605707b50d7c 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 605707b50d7c 3dedf3991d40 4bdcc08b04c4 1361ddff4486 4bdcc08b04c4 4bdcc08b04c4 4bdcc08b04c4 c0335c1dee36 c0335c1dee36 c0335c1dee36 63e49418a4cc c0335c1dee36 c0335c1dee36 3dedf3991d40 605707b50d7c 605707b50d7c cf51bbfb120e 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 2c0d35e336b5 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 a8f2d78d14ea c0335c1dee36 c0335c1dee36 3dedf3991d40 605707b50d7c 605707b50d7c cf51bbfb120e 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 3dedf3991d40 cf51bbfb120e 63e49418a4cc 63e49418a4cc cf51bbfb120e cf51bbfb120e 63e49418a4cc 63e49418a4cc c0335c1dee36 c0335c1dee36 c0335c1dee36 c0335c1dee36 c0335c1dee36 c0335c1dee36 | from rhodecode.tests import *
from rhodecode.model.db import RhodeCodeSetting
skip_ldap_test = False
try:
import ldap
except ImportError:
# means that python-ldap is not installed
skip_ldap_test = True
pass
class TestLdapSettingsController(TestController):
def test_index(self):
self.log_user()
response = self.app.get(url(controller='admin/ldap_settings',
action='index'))
response.mustcontain('LDAP administration')
def test_ldap_save_settings(self):
self.log_user()
if skip_ldap_test:
raise SkipTest('skipping due to missing ldap lib')
test_url = url(controller='admin/ldap_settings',
action='ldap_settings')
response = self.app.post(url=test_url,
params={'ldap_host' : u'dc.example.com',
'ldap_port' : '999',
'ldap_tls_kind' : 'PLAIN',
'ldap_tls_reqcert' : 'NEVER',
'ldap_dn_user':'test_user',
'ldap_dn_pass':'test_pass',
'ldap_base_dn':'test_base_dn',
'ldap_filter':'test_filter',
'ldap_search_scope':'BASE',
'ldap_attr_login':'test_attr_login',
'ldap_attr_firstname':'ima',
'ldap_attr_lastname':'tester',
'ldap_attr_email':'test@example.com' })
new_settings = RhodeCodeSetting.get_ldap_settings()
self.assertEqual(new_settings['ldap_host'], u'dc.example.com',
'fail db write compare')
self.checkSessionFlash(response,
'LDAP settings updated successfully')
def test_ldap_error_form(self):
self.log_user()
if skip_ldap_test:
raise SkipTest('skipping due to missing ldap lib')
test_url = url(controller='admin/ldap_settings',
action='ldap_settings')
response = self.app.post(url=test_url,
params={'ldap_host' : '',
'ldap_port' : 'i-should-be-number',
'ldap_tls_kind' : 'PLAIN',
'ldap_tls_reqcert' : 'NEVER',
'ldap_dn_user':'',
'ldap_dn_pass':'',
'ldap_base_dn':'',
'ldap_filter':'',
'ldap_search_scope':'BASE',
'ldap_attr_login':'', # <----- missing required input
'ldap_attr_firstname':'',
'ldap_attr_lastname':'',
'ldap_attr_email':'' })
response.mustcontain("""<span class="error-message">The LDAP Login"""
""" attribute of the CN must be specified""")
response.mustcontain("""<span class="error-message">Please """
"""enter a number</span>""")
def test_ldap_login(self):
pass
def test_ldap_login_incorrect(self):
pass
|