client = <FlaskClient <Flask 'swh.graphql.tests.conftest'>>
def test_get_content_with_invalid_hashes(client):
content = get_contents()[0]
query_str = """
{
contentByHash(checksums: ["blake2s256:%s", "sha1:%s", "sha1_git:%s", "sha256:%s"]) {
swhid
}
}
"""
errors = utils.get_error_response(
client,
query_str
% (
"invalid", # Only one hash is invalid
content.sha1.hex(),
content.sha1_git.hex(),
content.sha256.hex(),
),
)
# API will throw an error in case of an invalid content hash
> assert len(errors) == 1
E assert 2 == 1
E + where 2 = len([{'message': 'Argument \'checksums\' has invalid value ["blake2s256:invalid", "sha1:4fb76b6b9fd94175a35581ff7ae5e44d6cb8aabb", "sha1_git:86bc6b377e9d25f9d26777a4a28d08e63e7c5779", "sha256:42bfe54175d35ee13c15abe2a9da64c7c2fd01a8dc0afd42ec9f06c4f640f53e"].\n\nGraphQL request:3:32\n3 | contentByHash(checksums: ["blake2s256:invalid", "sha1:4fb76b6b9fd94175a355\n | ^\n | 81ff7ae5e44d6cb8aabb", "sha1_git:86bc6b377e9d25f9d26777a4a28d08e63e7c5779", "sha'}, {'locations': [{'column': 33, 'line': 3}], 'message': 'Expected value of type \'ContentHash\', found "blake2s256:invalid"; (\'Invalid content checksum\', ValueError(\'non-hexadecimal number found in fromhex() arg at position 0\'))'}])
.tox/py3/lib/python3.7/site-packages/swh/graphql/tests/functional/test_content.py:119: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Aug 30 2022, 3:25 PM