[test] Test de création/suppression de factures

This commit is contained in:
Valentin Samir 2013-11-24 20:12:56 +01:00
parent bd823060ce
commit 3cf36346ab

50
test.py
View file

@ -62,7 +62,9 @@ club_ldif = {
'chbre' : [ u'EXT' ], 'chbre' : [ u'EXT' ],
} }
facture_ldif = {} facture_ldif = {
'modePaiement' : [u'test'],
}
def keys_of_list_of_dict(l, type=''): def keys_of_list_of_dict(l, type=''):
@ -205,8 +207,6 @@ else:
tests_machines(adherent.dn, ["wifi-adh", "wifi-adh-v6"], ipsec=True) tests_machines(adherent.dn, ["wifi-adh", "wifi-adh-v6"], ipsec=True)
############################################# #############################################
# Création et suppression de machines Crans # # Création et suppression de machines Crans #
############################################# #############################################
@ -242,7 +242,28 @@ else:
else: print OK else: print OK
#######################################
# Création et suppression de factures #
#######################################
anim("Creation d'une facture")
try:
facture = conn.newFacture(adherent.dn, facture_ldif)
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")
try:
facture = conn.search(u'fid=%s' % facture['fid'][0], mode='rw')[0]
facture.delete()
except Exception:
print ERREUR
print traceback.format_exc()
else: print OK
############################ ############################
@ -258,26 +279,3 @@ if adherent:
print ERREUR print ERREUR
print traceback.format_exc() print traceback.format_exc()
else: print OK else: print OK
#######################################
# Création et suppression de factures #
#######################################
anim("Creation d'une facture")
try:
facture = conn.newFacture(facture_ldif)
except Exception as error:
print ERREUR
if show_traceback: print traceback.format_exc()
else: print "\t%r" % error
else:
print OK
try:
facture = conn.search(u'fid=%s' % facture['fid'][0], mode='rw')[0]
facture.delete()
except Exception:
print ERREUR
print traceback.format_exc()
else: print OK