equal
deleted
inserted
replaced
1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
49 """used to monkey patch the source to get successful authentication without |
49 """used to monkey patch the source to get successful authentication without |
50 upassword checking |
50 upassword checking |
51 """ |
51 """ |
52 assert login, 'no login!' |
52 assert login, 'no login!' |
53 searchfilter = [filter_format('(%s=%s)', (self.user_login_attr, login))] |
53 searchfilter = [filter_format('(%s=%s)', (self.user_login_attr, login))] |
54 searchfilter.extend([filter_format('(%s=%s)', ('objectClass', o)) |
54 searchfilter.extend(self.base_filters) |
55 for o in self.user_classes]) |
|
56 searchstr = '(&%s)' % ''.join(searchfilter) |
55 searchstr = '(&%s)' % ''.join(searchfilter) |
57 # first search the user |
56 # first search the user |
58 try: |
57 try: |
59 user = self._search(session, self.user_base_dn, self.user_base_scope, |
58 user = self._search(session, self.user_base_dn, self.user_base_scope, |
60 searchstr)[0] |
59 searchstr)[0] |
461 super(RQL2LDAPFilterTC, self).setUp() |
460 super(RQL2LDAPFilterTC, self).setUp() |
462 ldapsource = repo.sources[-1] |
461 ldapsource = repo.sources[-1] |
463 self.pool = repo._get_pool() |
462 self.pool = repo._get_pool() |
464 session = mock_object(pool=self.pool) |
463 session = mock_object(pool=self.pool) |
465 self.o = RQL2LDAPFilter(ldapsource, session) |
464 self.o = RQL2LDAPFilter(ldapsource, session) |
466 self.ldapclasses = ''.join('(objectClass=%s)' % ldapcls |
465 self.ldapclasses = ''.join(ldapsource.base_filters) |
467 for ldapcls in ldapsource.user_classes) |
|
468 |
466 |
469 def tearDown(self): |
467 def tearDown(self): |
470 self._repo.turn_repo_off() |
468 self._repo.turn_repo_off() |
471 super(RQL2LDAPFilterTC, self).tearDown() |
469 super(RQL2LDAPFilterTC, self).tearDown() |
472 |
470 |