Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/tests/functional/test_pagination.py
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | def test_invalid_first_arg(client): | ||||
assert (len(errors)) == 2 # one error for origins and anotehr one for pageInfo | assert (len(errors)) == 2 # one error for origins and anotehr one for pageInfo | ||||
assert ( | assert ( | ||||
errors[0]["message"] | errors[0]["message"] | ||||
== "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_too_big_first_arg(client): | def test_too_big_first_arg(client): | ||||
data, errors = get_origin_nodes(client, first=1001) # max page size is 1000 | from swh.graphql import server as app_server | ||||
# set the query cost limit to a higher value for this test | |||||
app_server.graphql_cfg = {"max_query_cost": {"anonymous": 2000}} | |||||
data, errors = get_origin_nodes(client, 1001) # max page size is 1000 | |||||
assert data["origins"] is None | assert data["origins"] is None | ||||
assert (len(errors)) == 2 | assert (len(errors)) == 2 | ||||
assert ( | assert ( | ||||
errors[0]["message"] | errors[0]["message"] | ||||
== "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 | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |