server/test/unittest_ldapuser.py
changeset 975 0928daea04e9
parent 360 600dd2fe8b40
child 1122 9f37de24251f
equal deleted inserted replaced
974:3ec0a7bd87ae 975:0928daea04e9
    31 config = TestServerConfiguration('data')
    31 config = TestServerConfiguration('data')
    32 config.sources_file = lambda : 'data/sourcesldap'
    32 config.sources_file = lambda : 'data/sourcesldap'
    33 repo, cnx = init_test_database('sqlite', config=config)
    33 repo, cnx = init_test_database('sqlite', config=config)
    34 
    34 
    35 class LDAPUserSourceTC(RepositoryBasedTC):
    35 class LDAPUserSourceTC(RepositoryBasedTC):
    36     repo = repo
    36     repo, cnx = repo, cnx
    37         
    37     
    38     def patch_authenticate(self):
    38     def patch_authenticate(self):
    39         self._orig_authenticate = LDAPUserSource.authenticate
    39         self._orig_authenticate = LDAPUserSource.authenticate
    40         LDAPUserSource.authenticate = nopwd_authenticate
    40         LDAPUserSource.authenticate = nopwd_authenticate
    41 
    41 
    42     def setUp(self):
    42     def setUp(self):
   240                            'NOT EXISTS(X copain T2, T2 login "billy")')
   240                            'NOT EXISTS(X copain T2, T2 login "billy")')
   241         self.assertEquals(sorted(rset.rows), [['guests', 'cochon'],
   241         self.assertEquals(sorted(rset.rows), [['guests', 'cochon'],
   242                                               ['users', 'cochon'],
   242                                               ['users', 'cochon'],
   243                                               ['users', 'syt']])
   243                                               ['users', 'syt']])
   244         
   244         
   245 
   245     def test_cd_restriction(self):
       
   246         rset = self.execute('EUser X WHERE X creation_date > "2009-02-01"')
       
   247         self.assertEquals(len(rset), 2) # admin/anon but no ldap user since it doesn't support creation_date
       
   248         
   246     def test_union(self):
   249     def test_union(self):
   247         afeids = self.execute('State X')
   250         afeids = self.execute('State X')
   248         ueids = self.execute('EUser X')
   251         ueids = self.execute('EUser X')
   249         rset = self.execute('(Any X WHERE X is State) UNION (Any X WHERE X is EUser)')
   252         rset = self.execute('(Any X WHERE X is State) UNION (Any X WHERE X is EUser)')
   250         self.assertEquals(sorted(r[0] for r in rset.rows),
   253         self.assertEquals(sorted(r[0] for r in rset.rows),