Skip to content

Commit

Permalink
Add tests for the schema endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklaus Johner committed Oct 25, 2019
1 parent 8d6eaf3 commit 63407cb
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions opengever/api/tests/test_schema.py
Original file line number Diff line number Diff line change
@@ -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']
)

0 comments on commit 63407cb

Please sign in to comment.