From 63407cb68059bd70fb206205a91f3a859ce3502a Mon Sep 17 00:00:00 2001 From: Niklaus Johner Date: Fri, 25 Oct 2019 16:22:31 +0200 Subject: [PATCH] Add tests for the schema endpoint. --- opengever/api/tests/test_schema.py | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 opengever/api/tests/test_schema.py diff --git a/opengever/api/tests/test_schema.py b/opengever/api/tests/test_schema.py new file mode 100644 index 00000000000..07e4c839668 --- /dev/null +++ b/opengever/api/tests/test_schema.py @@ -0,0 +1,39 @@ +from ftw.testbrowser import browsing +from opengever.testing import IntegrationTestCase + + +class TestSchemaEndpoint(IntegrationTestCase): + + @browsing + def test_schema_endpoint_id_for_vocabulary(self, browser): + self.login(self.regular_user, browser) + url = self.document.absolute_url() + '/@schema' + response = browser.open( + url, + method='GET', + headers=self.api_headers, + ).json + expected_url = "/".join( + (self.document.absolute_url(), + '@vocabularies/classification_classification_vocabulary')) + self.assertEqual( + expected_url, + response['properties']['classification']['vocabulary']['@id'] + ) + + @browsing + def test_schema_endpoint_id_for_querysource(self, browser): + self.login(self.regular_user, browser) + url = self.document.absolute_url() + '/@schema' + response = browser.open( + url, + method='GET', + headers=self.api_headers, + ).json + expected_url = "/".join( + (self.document.absolute_url(), + '@querysources/keywords')) + self.assertEqual( + expected_url, + response['properties']['keywords']['items']['querysource']['@id'] + )