8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-26 22:52:26 +00:00

Fix testing of cotisations.Cotisation objects

This commit is contained in:
Maël Kervella 2018-06-22 01:29:19 +00:00
parent 6c33559f00
commit fb78ec7a77

View file

@ -58,7 +58,7 @@ class APIEndpointsTestCase(APITestCase):
'/api/cotisations/banque/', '/api/cotisations/banque/',
'/api/cotisations/banque/1/', '/api/cotisations/banque/1/',
'/api/cotisations/cotisation/', '/api/cotisations/cotisation/',
# '/api/cotisations/cotisation/1/', '/api/cotisations/cotisation/1/',
'/api/cotisations/facture/', '/api/cotisations/facture/',
'/api/cotisations/facture/1/', '/api/cotisations/facture/1/',
'/api/cotisations/paiement/', '/api/cotisations/paiement/',
@ -302,15 +302,12 @@ class APIEndpointsTestCase(APITestCase):
duration=1, duration=1,
type_cotisation=cotisations.Vente.COTISATION_TYPE[0][0] type_cotisation=cotisations.Vente.COTISATION_TYPE[0][0]
) )
# Creation of this cotisation seems to revalidate the Vente object which of # A cotisation is automatically created by the Vente object and
# course already exists. # trying to create another cotisation associated with this vente
# FIXME # will fail so we simply retrieve it so it can be used in the tests
# cls.cotisations_cotisation_1 = cotisations.Cotisation.objects.create( cls.cotisations_cotisation_1 = cotisations.Cotisation.objects.get(
# vente=cls.cotisations_vente_1, # Dep cotisations.Vente vente=cls.cotisations_vente_1, # Dep cotisations.Vente
# type_cotisation=cotisations.Cotisation.COTISATION_TYPE[0][0], )
# date_start=datetime.datetime.now(datetime.timezone.utc),
# date_end=datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=1)
# )
cls.machines_machine_1 = machines.Machine.objects.create( cls.machines_machine_1 = machines.Machine.objects.create(
user=cls.users_user_1, # Dep users.User user=cls.users_user_1, # Dep users.User
name="machines_machine_1", name="machines_machine_1",
@ -350,7 +347,7 @@ class APIEndpointsTestCase(APITestCase):
ouverture_ports=cls.machines_ouvertureportlist_1 # Dep machines.OuverturePortList ouverture_ports=cls.machines_ouvertureportlist_1 # Dep machines.OuverturePortList
) )
# All IPs in the IpType range are autocreated so we can't create # All IPs in the IpType range are autocreated so we can't create
# new ones and thus we only retrieve it if needed in the test # new ones and thus we only retrieve it if needed in the tests
cls.machines_iplist_1 = machines.IpList.objects.get( cls.machines_iplist_1 = machines.IpList.objects.get(
ipv4="10.0.0.1", ipv4="10.0.0.1",
ip_type=cls.machines_iptype_1, # Dep machines.IpType ip_type=cls.machines_iptype_1, # Dep machines.IpType