Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/tests/functional/test_content.py
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | errors = utils.get_error_response( | ||||
% ( | % ( | ||||
"invalid", # Only one hash is invalid | "invalid", # Only one hash is invalid | ||||
content.sha1.hex(), | content.sha1.hex(), | ||||
content.sha1_git.hex(), | content.sha1_git.hex(), | ||||
content.sha256.hex(), | content.sha256.hex(), | ||||
), | ), | ||||
) | ) | ||||
# API will throw an error in case of an invalid content hash | # API will throw an error in case of an invalid content hash | ||||
assert len(errors) == 1 | assert len(errors) == 2 | ||||
assert "Input error: Invalid content checksum" in errors[0]["message"] | assert "Input error: Invalid content checksum" in errors[1]["message"] | ||||
def test_get_content_with_invalid_hash_algorithm(client): | def test_get_content_with_invalid_hash_algorithm(client): | ||||
content = get_contents()[0] | content = get_contents()[0] | ||||
query_str = """ | query_str = """ | ||||
{ | { | ||||
contentByHash(checksums: ["test:%s"]) { | contentByHash(checksums: ["test:%s"]) { | ||||
swhid | swhid | ||||
} | } | ||||
} | } | ||||
""" | """ | ||||
errors = utils.get_error_response(client, query_str % content.sha1.hex()) | errors = utils.get_error_response(client, query_str % content.sha1.hex()) | ||||
assert len(errors) == 1 | assert len(errors) == 2 | ||||
assert "Input error: Invalid hash algorithm" in errors[0]["message"] | assert "Input error: Invalid hash algorithm" in errors[1]["message"] | ||||
def test_get_content_as_target(client): | def test_get_content_as_target(client): | ||||
# SWHID of a test dir with a file entry | # SWHID of a test dir with a file entry | ||||
directory_swhid = "swh:1:dir:87b339104f7dc2a8163dec988445e3987995545f" | directory_swhid = "swh:1:dir:87b339104f7dc2a8163dec988445e3987995545f" | ||||
query_str = """ | query_str = """ | ||||
{ | { | ||||
directory(swhid: "%s") { | directory(swhid: "%s") { | ||||
Show All 21 Lines |