-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow including tokens in querystring vocabs #1403
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
make `test_endpoint_inlines_vocabularies` more resilient and able to pass with vocabularies that include tokens |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,10 +99,26 @@ def test_endpoint_inlines_vocabularies(self): | |
"published": {"title": "Published with accent \xe9 [published]"}, | ||
"visible": {"title": "Public draft [visible]"}, | ||
} | ||
|
||
self.assertTrue("external" in (idx["values"].keys())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. included in the subsequent test |
||
self.assertTrue( | ||
all(elem in idx["values"].items() for elem in expected_vocab_values.items()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ksuess I removed this check as it only was breaking with the new inclusion of tokens inside of vocabularies returned in plone/plone.app.querystring#107. Also I was not able to determine what is tested here anyways in a glimbs, as this nesting of loops, although short and elegant, is not really easy to read. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am OK with your refactoring, especially because this test 'test_endpoint_inlines_vocabularies' is not about testing the existence of review states, but about testing the format of the response of the 'querystring' endpoint. |
||
set(expected_vocab_values.keys()).issubset((idx["values"].keys())) | ||
) | ||
|
||
self.assertEqual( | ||
expected_vocab_values["external"]["title"], | ||
idx["values"]["external"]["title"], | ||
) | ||
|
||
# Only checking token if it actually exists | ||
if len(idx["values"]["external"]) > 1: | ||
self.assertTrue("token" in (idx["values"]["external"].keys())) | ||
|
||
self.assertEqual( | ||
"external", | ||
idx["values"]["external"]["token"], | ||
) | ||
|
||
def test_endpoint_inlines_operators(self): | ||
response = self.api_session.get("/@querystring") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With your refactoring of the tests, the 'expected_vocab_values' can already be updated with the additional token.