-
Notifications
You must be signed in to change notification settings - Fork 498
REST: Add pagination support for list_views #3349
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
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 |
|---|---|---|
|
|
@@ -639,6 +639,54 @@ def test_list_views_200(rest_mock: Mocker) -> None: | |
| assert RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN).list_views(namespace) == [("examples", "fooshare")] | ||
|
|
||
|
|
||
| def test_list_views_paginated_200(rest_mock: Mocker) -> None: | ||
|
Member
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. Can we add some tests for an ommitted field and null for the next_page_token, and ensure the behavior is the same?
Member
Author
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. This test (test_list_views_paginated_200) verifies the omitted Let me know if you want me to add more tests. |
||
| namespace = "examples" | ||
| # First page with next-page-token | ||
| rest_mock.get( | ||
| f"{TEST_URI}v1/namespaces/{namespace}/views", | ||
| json={ | ||
| "identifiers": [ | ||
| {"namespace": ["examples"], "name": "view1"}, | ||
| {"namespace": ["examples"], "name": "view2"}, | ||
| ], | ||
| "next-page-token": "page2token", | ||
| }, | ||
| status_code=200, | ||
| request_headers=TEST_HEADERS, | ||
| ) | ||
| # Second page with next-page-token | ||
| rest_mock.get( | ||
| f"{TEST_URI}v1/namespaces/{namespace}/views?pageToken=page2token", | ||
| json={ | ||
| "identifiers": [ | ||
| {"namespace": ["examples"], "name": "view3"}, | ||
| ], | ||
| "next-page-token": "page3token", | ||
| }, | ||
| status_code=200, | ||
| request_headers=TEST_HEADERS, | ||
| ) | ||
| # Third page without next-page-token (last page) | ||
| rest_mock.get( | ||
| f"{TEST_URI}v1/namespaces/{namespace}/views?pageToken=page3token", | ||
| json={ | ||
| "identifiers": [ | ||
| {"namespace": ["examples"], "name": "view4"}, | ||
| ], | ||
| }, | ||
| status_code=200, | ||
| request_headers=TEST_HEADERS, | ||
| ) | ||
|
|
||
| result = RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN).list_views(namespace) | ||
| assert result == [ | ||
| ("examples", "view1"), | ||
| ("examples", "view2"), | ||
| ("examples", "view3"), | ||
| ("examples", "view4"), | ||
| ] | ||
|
|
||
|
|
||
| def test_list_views_200_sigv4(rest_mock: Mocker) -> None: | ||
| namespace = "examples" | ||
| rest_mock.get( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.