-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add ResponseProperties object and example refactor #213
Conversation
2acf655
to
75fe3a3
Compare
After #214 will get merged I will refactor it to use ResponseProperties object. |
75fe3a3
to
06e120b
Compare
@@ -14,7 +15,7 @@ def header_name(request): | |||
def responses(header_name): | |||
"""Returns response to be added to the AuthConfig""" | |||
return [ | |||
{"name": "header", "wrapperKey": header_name, "json": {"properties": [{"name": "anything", "value": "one"}]}} | |||
ResponseProperties(name="header", wrapperKey=header_name, properties=[JsonProperty("anything", Value("one"))]) |
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.
Not sold on the need to use it everywhere, I would rather see it used in the backend e.g. replacing it only in AuthConfig, but leave the test as is, @jsmolar WDYT?
Some elements from this PR were used in the reformat of the AuthConfig responses section #220. |
06e120b
to
9d0ef8b
Compare
I rewrote most of the PR for better usage |
9d0ef8b
to
5a39f66
Compare
testsuite/objects/__init__.py
Outdated
def __init__(self, value=None, jsonPath=None) -> None: | ||
super().__init__() | ||
if not (value is None) ^ (jsonPath is None): | ||
value: Optional[Union[str, list, dict]] = None |
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.
Should the type be Optional[Any]
?
5a39f66
to
8a33579
Compare
testsuite/objects/__init__.py
Outdated
|
||
|
||
@dataclass | ||
class ExtendedProperty(JsonProperty): |
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.
ExtendedProperty
has only one additional "feature" then JsonProperty
(overwrite
)?
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.
Yes, I am mimicking source code classes https://github.com/Kuadrant/authorino/blob/v0.14.0/api/v1beta1/auth_config_types.go#L190
8a33579
to
971c4c0
Compare
Closing in favor of #220 |
Based on commit b042b30 in #212
Usage of dynamic response function is quite common in tests to expose and check Authorino internal variables. I propose creating new object for easier definition of this function without the need to construct complicated dictionaries in tests.
Contains fix of Value class to dataclass.
This PR also contains example refactor of https://github.com/Kuadrant/testsuite/tree/main/testsuite/tests/kuadrant/authorino/response tests.