Skip to content

Commit

Permalink
Add translation in test to see in documentation how an example respon…
Browse files Browse the repository at this point in the history
…se would look like
  • Loading branch information
ksuess committed Aug 23, 2023
1 parent b03a9f8 commit 129c81b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/source/endpoints/translations.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ To unlink the content, issue a `DELETE` request on the `@translations` endpoint
## Creating a translation from an existing content

The `POST` content endpoint to a folder is also capable of linking this new content with an
exising translation using two parameters: `translationOf` and `language`.
existing translation using two parameters: `translationOf` and `language`.

```{eval-rst}
.. http:example:: curl httpie python-requests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ Content-Type: application/json
},
"translations": {
"@id": "http://localhost:55001/plone/en/test-document/@translations",
"items": [],
"items": [
{
"@id": "http://localhost:55001/plone/es/test-document",
"language": "es"
}
],
"root": {
"de": "http://localhost:55001/plone/de",
"en": "http://localhost:55001/plone/en",
Expand Down
28 changes: 16 additions & 12 deletions src/plone/restapi/tests/test_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2169,18 +2169,6 @@ def test_documentation_translations_post(self):
)
save_request_and_response_for_docs("translations_post", response)

def test_documentation_translations_unexpanded_get(self):
response = self.api_session.get(
f"{self.en_content.absolute_url()}",
)
save_request_and_response_for_docs("translations_unexpanded_get", response)

def test_documentation_translations_expand_get(self):
response = self.api_session.get(
f"{self.en_content.absolute_url()}?expand=translations",
)
save_request_and_response_for_docs("translations_expand_get", response)

def test_documentation_translations_post_by_id(self):
response = self.api_session.post(
f"{self.en_content.absolute_url()}/@translations",
Expand Down Expand Up @@ -2237,6 +2225,22 @@ def test_documentation_translation_locator(self):
)
save_request_and_response_for_docs("translation_locator", response)

def test_documentation_translations_unexpanded_get(self):
response = self.api_session.get(
f"{self.en_content.absolute_url()}",
)
save_request_and_response_for_docs("translations_unexpanded_get", response)

def test_documentation_translations_expand_get(self):
self.api_session.post(
f"{self.en_content.absolute_url()}/@translations",
json={"id": self.es_content.absolute_url()},
)
response = self.api_session.get(
f"{self.en_content.absolute_url()}?expand=translations",
)
save_request_and_response_for_docs("translations_expand_get", response)

def test_site_navroot_get(self):
response = self.api_session.get("/@navroot")
save_request_and_response_for_docs("navroot_site_get", response)
Expand Down

0 comments on commit 129c81b

Please sign in to comment.