diff --git a/attributs_tests.py b/attributs_tests.py index 44e481b..1511225 100755 --- a/attributs_tests.py +++ b/attributs_tests.py @@ -32,7 +32,7 @@ import unittest -from lc_ldap_tests import LDAPTest +from lc_ldap_tests import LDAPTest, auto_suite from attributs import * class nomTest(LDAPTest): @@ -84,14 +84,6 @@ class telTest(LDAPTest): attr = self.attrify_light(u"+42 (0) 1 23456789", "tel") self.assertEqual(str(attr), "0042123456789") - -def auto_suite(testcase): - """Suite de tests 'automatique'""" - suite = unittest.TestSuite() - for test in testcase.tests: - suite.addTest(testcase(test)) - return suite - TEST_SUITE = unittest.TestSuite(( auto_suite(nomTest), auto_suite(prenomTest), diff --git a/lc_ldap_tests.py b/lc_ldap_tests.py index 8379e1a..213a248 100755 --- a/lc_ldap_tests.py +++ b/lc_ldap_tests.py @@ -43,3 +43,36 @@ class LDAPTest(unittest.TestCase): def attrify_light(self, val, champ): """Transforme une valeur en objet Attr avec un LDIF minimaliste""" return attrify(val, champ, {champ: [val]}, self.ldap) + +class AdherentTest(LDAPTest): + """Classe de test de la création d'un adhérent""" + tests = ["creationAdherent","suppressionAdherent"] + + def creationAdherent(self): + """Crée un adhérent""" + self.adherent = self.ldap.newAdherent({ + 'nom': [u"Passoir"], + 'prenom': [u"Toto"], + 'tel': [u"01 23 45 67 89"], + 'chbre': [u"G001"], + }) + + def suppressionAdherent(self): + """Supprime l'adhérent en question""" + pass + + +def auto_suite(testcase): + """Suite de tests 'automatique'""" + suite = unittest.TestSuite() + for test in testcase.tests: + suite.addTest(testcase(test)) + return suite + +TEST_SUITE = unittest.TestSuite(( + auto_suite(AdherentTest), + )) + +if __name__ == "__main__": + RUNNER = unittest.TextTestRunner() + RUNNER.run(TEST_SUITE)