Changeset View
Changeset View
Standalone View
Standalone View
swh/graph/tests/test_api_client.py
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | def test_count(graph_client): | ||||
assert actual == 3 | assert actual == 3 | ||||
actual = graph_client.count_neighbors( | actual = graph_client.count_neighbors( | ||||
"swh:1:rev:0000000000000000000000000000000000000009", direction="backward" | "swh:1:rev:0000000000000000000000000000000000000009", direction="backward" | ||||
) | ) | ||||
assert actual == 3 | assert actual == 3 | ||||
def test_param_validation(graph_client): | def test_param_validation(graph_client): | ||||
with raises(RemoteException) as exc_info: # PID not found | with raises(RemoteException) as exc_info: # SWHID not found | ||||
list(graph_client.leaves("swh:1:ori:fff0000000000000000000000000000000000021")) | list(graph_client.leaves("swh:1:ori:fff0000000000000000000000000000000000021")) | ||||
assert exc_info.value.response.status_code == 404 | assert exc_info.value.response.status_code == 404 | ||||
with raises(RemoteException) as exc_info: # malformed PID | with raises(RemoteException) as exc_info: # malformed SWHID | ||||
list( | list( | ||||
graph_client.neighbors("swh:1:ori:fff000000zzzzzz0000000000000000000000021") | graph_client.neighbors("swh:1:ori:fff000000zzzzzz0000000000000000000000021") | ||||
) | ) | ||||
assert exc_info.value.response.status_code == 400 | assert exc_info.value.response.status_code == 400 | ||||
with raises(RemoteException) as exc_info: # malformed edge specificaiton | with raises(RemoteException) as exc_info: # malformed edge specificaiton | ||||
list( | list( | ||||
graph_client.visit_nodes( | graph_client.visit_nodes( | ||||
Show All 32 Lines |