# HG changeset patch # User Sylvain Thénault # Date 1357855545 -3600 # Node ID 4fea61c636b2d5edc1dfdad20397d0fa1d09cad1 # Parent 5a394fc419b4618d1aa512eba9e09e498a333fdb [ldap test] ensure slapdd launch went fine and move ldapfeed setUp to parent class, as all ldap sources deal with url diff -r 5a394fc419b4 -r 4fea61c636b2 server/test/unittest_ldapuser.py --- a/server/test/unittest_ldapuser.py Thu Jan 10 18:11:33 2013 +0100 +++ b/server/test/unittest_ldapuser.py Thu Jan 10 23:05:45 2013 +0100 @@ -1,4 +1,4 @@ -# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of CubicWeb. @@ -53,7 +53,7 @@ ldiffile = join(config.apphome, "ldap_test.ldif") config.info('Initing ldap database') cmdline = "/usr/sbin/slapadd -f %s -l %s -c" % (slapdconf, ldiffile) - subprocess.call(cmdline, shell=True) + subprocess.check_call(cmdline, shell=True) == 0 #ldapuri = 'ldapi://' + join(basedir, "ldapi").replace('/', '%2f') port = get_available_port(xrange(9000, 9100)) @@ -95,6 +95,14 @@ def tearDownClass(cls): terminate_slapd(cls) + def setUp(self): + super(LDAPTestBase, self).setUp() + # ldap source url in the database may use a different port as the one + # just attributed + lfsource = self.repo.sources_by_uri['ldapuser'] + lfsource.urls = [URL] + + class DeleteStuffFromLDAPFeedSourceTC(LDAPTestBase): test_db_id = 'ldap-feed' @@ -172,6 +180,7 @@ self.commit() self.assertRaises(AuthenticationError, self.repo.connect, 'syt', password='syt') + class LDAPFeedSourceTC(LDAPTestBase): test_db_id = 'ldap-feed' @@ -184,13 +193,6 @@ lfsource = isession.repo.sources_by_uri['ldapuser'] stats = lfsource.pull_data(isession, force=True, raise_on_error=True) - def setUp(self): - super(LDAPFeedSourceTC, self).setUp() - # ldap source url in the database may use a different port as the one - # just attributed - lfsource = self.repo.sources_by_uri['ldapuser'] - lfsource.urls = [URL] - def assertMetadata(self, entity): self.assertTrue(entity.creation_date) self.assertTrue(entity.modification_date)