mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-10 00:18:57 +00:00
Fix: fix notes serializing in API document response (#9336)
This commit is contained in:
@@ -2170,8 +2170,10 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
GIVEN:
|
||||
- A document with a single note
|
||||
WHEN:
|
||||
- API request for document
|
||||
- API request for document notes is made
|
||||
THEN:
|
||||
- Note is included in the document response
|
||||
- The associated note is returned
|
||||
"""
|
||||
doc = Document.objects.create(
|
||||
@@ -2185,6 +2187,18 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
user=self.user,
|
||||
)
|
||||
|
||||
response = self.client.get(
|
||||
f"/api/documents/{doc.pk}/",
|
||||
format="json",
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
resp_data = response.json()
|
||||
self.assertEqual(len(resp_data["notes"]), 1)
|
||||
self.assertEqual(resp_data["notes"][0]["note"], note.note)
|
||||
self.assertEqual(resp_data["notes"][0]["user"]["username"], self.user.username)
|
||||
|
||||
response = self.client.get(
|
||||
f"/api/documents/{doc.pk}/notes/",
|
||||
format="json",
|
||||
|
Reference in New Issue
Block a user