#31 API Deductions Tests

* adds tests for deduction API
This commit is contained in:
2022-01-28 16:21:23 +01:00
parent 9b18b877d5
commit cbf871f4b4
8 changed files with 124 additions and 10 deletions

View File

@@ -45,7 +45,7 @@ class APIV1CreateTestCase(BaseAPIV1TestCase):
self.assertIsNotNone(content.get("id", None), msg=response.content)
def test_create_intervention(self):
""" Tests api creation of bare minimum interventions
""" Tests api creation
Returns:
@@ -57,7 +57,7 @@ class APIV1CreateTestCase(BaseAPIV1TestCase):
self._test_create_object(url, post_body)
def test_create_compensation(self):
""" Tests api creation of bare minimum interventions
""" Tests api creation
Returns:
@@ -80,7 +80,7 @@ class APIV1CreateTestCase(BaseAPIV1TestCase):
self._test_create_object(url, post_body)
def test_create_eco_account(self):
""" Tests api creation of bare minimum interventions
""" Tests api creation
Returns:
@@ -92,7 +92,7 @@ class APIV1CreateTestCase(BaseAPIV1TestCase):
self._test_create_object(url, post_body)
def test_create_ema(self):
""" Tests api creation of bare minimum interventions
""" Tests api creation
Returns:
@@ -103,3 +103,20 @@ class APIV1CreateTestCase(BaseAPIV1TestCase):
post_body = json.load(fp=json_file)
self._test_create_object(url, post_body)
def test_create_deduction(self):
""" Tests api creation
Returns:
"""
self.intervention.share_with(self.superuser)
self.eco_account.share_with(self.superuser)
url = reverse("api:v1:deduction")
json_file_path = "api/tests/v1/create/deduction_create_post_body.json"
with open(json_file_path) as json_file:
post_body = json.load(fp=json_file)
post_body["intervention"] = str(self.intervention.id)
post_body["eco_account"] = str(self.eco_account.id)
self._test_create_object(url, post_body)