Skip to content
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

implements regression test for #535 #537

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion tests/rest_api/test_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
create_auth,
create_paginator,
_make_endpoint_resource,
_merge_resource_endpoints,
process_parent_data_item,
setup_incremental_object,
create_response_hooks,
Expand All @@ -42,6 +43,7 @@
AuthType,
AuthTypeConfig,
EndpointResource,
EndpointResourceBase,
PaginatorType,
PaginatorTypeConfig,
RESTAPIConfig,
Expand Down Expand Up @@ -169,7 +171,7 @@ def test_allow_deprecated_json_response_paginator(mock_api_server) -> None:
Delete this test as soon as we stop supporting the deprecated key json_response
for the JSONLinkPaginator
"""
config: RESTAPIConfig = { # type: ignore
config: RESTAPIConfig = { # type: ignore
"client": {"base_url": "https://api.example.com"},
"resources": [
{
Expand Down Expand Up @@ -1249,3 +1251,28 @@ def test_circular_resource_bindingis_invalid() -> None:
with pytest.raises(CycleError) as e:
rest_api_resources(config)
assert e.match(re.escape("'nodes are in a cycle', ['chicken', 'egg', 'chicken']"))


def test_default_params_get_merged() -> None:
resource_defaults: EndpointResourceBase = {
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"params": {
"per_page": 30,
},
},
}

resource: EndpointResource = {
"endpoint": {
"path": "issues",
"params": {
"sort": "updated",
"direction": "desc",
"state": "open",
},
},
}
merged_resource = _merge_resource_endpoints(resource_defaults, resource)
assert merged_resource["endpoint"]["params"]["per_page"] == 30
Loading