[test.py] Quelques tests en plus
This commit is contained in:
parent
83b2e65a9d
commit
e71686c9b2
1 changed files with 29 additions and 17 deletions
46
test.py
46
test.py
|
@ -67,7 +67,7 @@ club_ldif = {
|
|||
}
|
||||
|
||||
facture_ldif = {
|
||||
'modePaiement' : [u'test'],
|
||||
'modePaiement' : [u'liquide'],
|
||||
}
|
||||
|
||||
|
||||
|
@ -195,6 +195,17 @@ if not mail_format:
|
|||
print "Test des attributs des adhérents"
|
||||
test_list_of_dict(adherents_attrs_keys, adherents)
|
||||
|
||||
factures = conn.search(u"fid=*", sizelimit=-1, mode='ro' if fast_test else 'rw')
|
||||
factures_attrs_keys = keys_of_list_of_dict(factures, 'factures')
|
||||
if not mail_format:
|
||||
print "Test des attributs des factures"
|
||||
test_list_of_dict(factures_attrs_keys, factures)
|
||||
|
||||
certificats = conn.search(u"xid=*", sizelimit=-1, mode='ro' if fast_test else 'rw')
|
||||
certificats_attrs_keys = keys_of_list_of_dict(certificats, 'certificats')
|
||||
if not mail_format:
|
||||
print "Test des attributs des certificats"
|
||||
test_list_of_dict(certificats_attrs_keys, certificats)
|
||||
|
||||
if not mail_format:
|
||||
print "Test de création d'objets"
|
||||
|
@ -259,24 +270,25 @@ else:
|
|||
# Création et suppression de factures #
|
||||
#######################################
|
||||
|
||||
anim("Creation d'une facture")
|
||||
try:
|
||||
with conn.newFacture(adherent.dn, facture_ldif) as facture:
|
||||
facture.create()
|
||||
except Exception as error:
|
||||
print ERREUR
|
||||
if show_traceback: print traceback.format_exc()
|
||||
else: print "\t%r" % error
|
||||
else:
|
||||
print OK
|
||||
anim("Suppression d'une facture")
|
||||
if adherent:
|
||||
anim("Creation d'une facture")
|
||||
try:
|
||||
with conn.search(u'fid=%s' % facture['fid'][0], mode='rw')[0] as facture:
|
||||
facture.delete()
|
||||
except Exception:
|
||||
with conn.newFacture(adherent.dn, facture_ldif) as facture:
|
||||
facture.create()
|
||||
except Exception as error:
|
||||
print ERREUR
|
||||
print traceback.format_exc()
|
||||
else: print OK
|
||||
if show_traceback: print traceback.format_exc()
|
||||
else: print "\t%r" % error
|
||||
else:
|
||||
print OK
|
||||
anim("Suppression d'une facture")
|
||||
try:
|
||||
with conn.search(u'fid=%s' % facture['fid'][0], mode='rw')[0] as facture:
|
||||
facture.delete()
|
||||
except Exception:
|
||||
print ERREUR
|
||||
print traceback.format_exc()
|
||||
else: print OK
|
||||
|
||||
|
||||
############################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue