diff --git a/test.py b/test.py index e67faa9..d122630 100755 --- a/test.py +++ b/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 ############################