Skip to content

Commit

Permalink
Add response data assert on create onderwerp api test
Browse files Browse the repository at this point in the history
  • Loading branch information
Floris272 committed Dec 24, 2024
1 parent 92e4d16 commit 4f450b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/open_producten/producttypen/tests/api/test_onderwerp.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ def test_create_minimal_onderwerp(self):

self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(Onderwerp.objects.count(), 1)
onderwerp = Onderwerp.objects.first()
expected_data = {
"id": str(onderwerp.id),
"naam": onderwerp.naam,
"beschrijving": onderwerp.beschrijving,
"vragen": [],
"gepubliceerd": False,
"hoofd_onderwerp": None,
"product_typen": [],
"aanmaak_datum": onderwerp.aanmaak_datum.astimezone().isoformat(),
"update_datum": onderwerp.update_datum.astimezone().isoformat(),
}
self.assertEqual(response.data, expected_data)

def test_create_onderwerp_with_hoofd_onderwerp(self):
self.maxDiff = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_create_minimal_product_type(self):
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(ProductType.objects.count(), 1)

product_type = ProductType.objects.get(id=response.data["id"])
product_type = ProductType.objects.first()
onderwerp = product_type.onderwerpen.first()
expected_data = {
"id": str(product_type.id),
Expand Down

0 comments on commit 4f450b5

Please sign in to comment.