[tests] Ajout de tests pour lc_ldap.
This commit is contained in:
parent
42555cb63d
commit
7ae277e7be
2 changed files with 34 additions and 9 deletions
|
@ -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),
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue