#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

@@ -8,6 +8,7 @@ Created on: 28.01.22
import json
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from api.tests.v1.share.test_api_sharing import BaseAPIV1TestCase
@@ -93,3 +94,25 @@ class APIV1DeleteTestCase(BaseAPIV1TestCase):
url = reverse("api:v1:ema", args=(str(test_ema.id),))
self._test_delete_object(test_ema, url)
def test_delete_deduction(self):
""" Tests api creation of bare minimum interventions
Returns:
"""
test_deduction = self.create_dummy_deduction()
test_deduction.intervention.share_with(self.superuser)
url = reverse("api:v1:deduction", args=(str(test_deduction.id),))
response = self._run_delete_request(url)
content = json.loads(response.content)
self.assertEqual(response.status_code, 200, msg=response.content)
self.assertTrue(content.get("success", False), msg=response.content)
try:
test_deduction.refresh_from_db()
self.fail("Deduction is not deleted from db!")
except ObjectDoesNotExist:
pass