Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/tests/functional/test_pagination.py
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | assert ( | ||||
== "Pagination error: Value for argument 'first' is invalid; it must be between 0 and 1000" # noqa: B950 | == "Pagination error: Value for argument 'first' is invalid; it must be between 0 and 1000" # noqa: B950 | ||||
) | ) | ||||
def test_after_arg(client): | def test_after_arg(client): | ||||
first_data, _ = get_origin_nodes(client, first=1) | first_data, _ = get_origin_nodes(client, first=1) | ||||
end_cursor = first_data["origins"]["pageInfo"]["endCursor"] | end_cursor = first_data["origins"]["pageInfo"]["endCursor"] | ||||
# get again with endcursor as the after argument | # get again with endcursor as the after argument | ||||
# import pdb; pdb.set_trace() | |||||
data, _ = get_origin_nodes(client, first=1, after=end_cursor) | data, _ = get_origin_nodes(client, first=1, after=end_cursor) | ||||
assert len(data["origins"]["nodes"]) == 1 | assert len(data["origins"]["nodes"]) == 1 | ||||
assert data["origins"]["pageInfo"] == {"hasNextPage": False, "endCursor": None} | assert data["origins"]["pageInfo"] == {"hasNextPage": False, "endCursor": None} | ||||
def test_invalid_after_arg(client): | def test_invalid_after_arg(client): | ||||
data, errors = get_origin_nodes(client, first=1, after="invalid") | data, errors = get_origin_nodes(client, first=1, after="invalid") | ||||
assert data["origins"] is None | assert data["origins"] is None | ||||
Show All 30 Lines |