Back to index

moin  1.9.0~rc2
Classes | Public Member Functions | Public Attributes | Static Public Attributes
test_ldap_login.TestLdapFailover Class Reference

List of all members.

Classes

class  Config

Public Member Functions

def setup_class
def teardown_class
def testMoinLDAPFailOver

Public Attributes

 ldap_envs

Static Public Attributes

 basedn = BASEDN
 rootdn = ROOTDN
 rootpw = ROOTPW
 slapd_config = SLAPD_CONFIG
 ldif_content = LDIF_CONTENT

Detailed Description

Definition at line 177 of file test_ldap_login.py.


Member Function Documentation

Create LDAP servers environment, start slapds 

Definition at line 196 of file test_ldap_login.py.

00196 
00197     def setup_class(self):
00198         """ Create LDAP servers environment, start slapds """
00199         self.ldap_envs = []
00200         for instance in range(2):
00201             ldap_env = LdapEnvironment(self.basedn, self.rootdn, self.rootpw, instance=instance)
00202             ldap_env.create_env(slapd_config=self.slapd_config)
00203             started = ldap_env.start_slapd()
00204             if not started:
00205                 py.test.skip("Failed to start %s process, please see your syslog / log files"
00206                              " (and check if stopping apparmor helps, in case you use it)." % SLAPD_EXECUTABLE)
00207             ldap_env.load_directory(ldif_content=self.ldif_content)
00208             self.ldap_envs.append(ldap_env)

Stop slapd, remove LDAP server environment 

Definition at line 209 of file test_ldap_login.py.

00209 
00210     def teardown_class(self):
00211         """ Stop slapd, remove LDAP server environment """
00212         for ldap_env in self.ldap_envs:
00213             try:
00214                 ldap_env.stop_slapd()
00215             except:
00216                 pass # one will fail, because it is already stopped
00217             ldap_env.destroy_env()

Try if it does a failover to a secondary LDAP, if the primary fails. 

Definition at line 218 of file test_ldap_login.py.

00218 
00219     def testMoinLDAPFailOver(self):
00220         """ Try if it does a failover to a secondary LDAP, if the primary fails. """
00221         handle_auth = self.request.handle_auth
00222 
00223         # authenticate user (with primary slapd):
00224         u1 = handle_login(self.request, None, username='usera', password='usera')
00225         assert u1 is not None
00226         assert u1.valid
00227 
00228         # now we kill our primary LDAP server:
00229         self.ldap_envs[0].slapd.stop()
00230 
00231         # try if we can still authenticate (with the second slapd):
00232         u2 = handle_login(self.request, None, username='usera', password='usera')
00233         assert u2 is not None
00234         assert u2.valid
00235 
00236 
00237 

Here is the call graph for this function:


Member Data Documentation

Definition at line 178 of file test_ldap_login.py.

Definition at line 198 of file test_ldap_login.py.

Definition at line 182 of file test_ldap_login.py.

Definition at line 179 of file test_ldap_login.py.

Definition at line 180 of file test_ldap_login.py.

Definition at line 181 of file test_ldap_login.py.


The documentation for this class was generated from the following file: