Skip to content

Commit

Permalink
rest_api paginator: Allows using JSONResponsePaginator in place of JS…
Browse files Browse the repository at this point in the history
…ONLinkPaginator
  • Loading branch information
willi-mueller committed Jul 24, 2024
1 parent 123c5be commit 823304e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/rest_api/test_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
OffsetPaginator,
PageNumberPaginator,
SinglePagePaginator,
JSONResponsePaginator,
)

try:
Expand Down Expand Up @@ -169,7 +170,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 All @@ -188,6 +189,27 @@ def test_allow_deprecated_json_response_paginator(mock_api_server) -> None:
rest_api_source(config)


def test_allow_deprecated_json_response_paginator_2(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
"client": {"base_url": "https://api.example.com"},
"resources": [
{
"name": "posts",
"endpoint": {
"path": "posts",
"paginator": JSONResponsePaginator(next_url_path="links.next"),
},
},
],
}

rest_api_source(config)


@pytest.mark.parametrize("auth_type", get_args(AuthType))
@pytest.mark.parametrize(
"section", ("SOURCES__REST_API__CREDENTIALS", "SOURCES__CREDENTIALS", "CREDENTIALS")
Expand Down

0 comments on commit 823304e

Please sign in to comment.