[attributs_tests] Prénom et Téléphone
This commit is contained in:
parent
4bbb0ed051
commit
72e7f49f6c
1 changed files with 36 additions and 1 deletions
|
@ -51,6 +51,41 @@ class nomTest(LDAPTest):
|
|||
self.assertRaises(Exception, attrify_light, "Stringman", "nom")
|
||||
self.assertRaises(Exception, attrify_light, u" Spaceman", "nom")
|
||||
|
||||
class prenomTest(LDAPTest):
|
||||
"""Tests sur l'attribut prenom"""
|
||||
tests = ["acceptPrenom"]
|
||||
def acceptPrenom(self):
|
||||
"""Accepte les prénoms de la liste définie"""
|
||||
attrify_light(u"Nicolas", "prenom")
|
||||
attrify_light(u"Gérard", "prenom")
|
||||
attrify_light(u"John-Éric", "prenom")
|
||||
attrify_light(u"Charles Jean", "prenom")
|
||||
self.assertRaises(Exception, attrify_light, "String", "prenom")
|
||||
self.assertRaises(Exception, attrify_light, u" Space", "prenom")
|
||||
|
||||
class telTest(LDAPTest):
|
||||
"""Tests sur l'attribut tel"""
|
||||
tests = ["acceptTel", "normalizeTel"]
|
||||
def acceptTel(self):
|
||||
"""Accepte les numéros de la liste définie"""
|
||||
attrify_light(u"01 23 45 67 89", "tel")
|
||||
attrify_light(u"0000000000", "tel")
|
||||
attrify_light(u"00 33 1 23 45 67 89", "tel")
|
||||
attrify_light(u"+42 (0) 1 23456789", "tel")
|
||||
self.assertRaises(Exception, attrify_light, "", "tel")
|
||||
self.assertRaises(Exception, attrify_light, u"caracteres?!", "nom")
|
||||
|
||||
def normalizeTel(self):
|
||||
"""Normalise correctement les numéros de téléphone"""
|
||||
attr = attrify_light(u"01 23 45 67 89", "tel")
|
||||
self.assertEqual(str(attr), "0123456789")
|
||||
attr = attrify_light(u"0000000000", "tel")
|
||||
self.assertEqual(str(attr), "0000000000")
|
||||
attr = attrify_light(u"00 33 1 23 45 67 89", "tel")
|
||||
self.assertEqual(str(attr), "0033123456789")
|
||||
attr = attrify_light(u"+42 (0) 1 23456789", "tel")
|
||||
self.assertEqual(str(attr), "0042123456789")
|
||||
|
||||
|
||||
def auto_suite(testcase):
|
||||
"""Suite de tests 'automatique'"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue