api_client = <rest_framework.test.APIClient object at 0x7f7a2aa5f5f8>
@given(origin(), content(), directory(), release(), revision(), snapshot())
> def test_swhid_resolve_success(
api_client, origin, content, directory, release, revision, snapshot
):
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_identifiers.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
api_client = <rest_framework.test.APIClient object at 0x7f7a2aa5f5f8>
origin = {'archives': ['highlightjs-line-numbers.js.zip', 'highlightjs-line-numbers.js_visit2.zip'], 'type': 'git', 'url': 'https://github.com/wcoder/highlightjs-line-numbers.js'}
content = {'blake2s256': '6ab27bfba471ed5b5b472c7210d31e2ac1e8a560cc954efe9149e88f6dab192d', 'data': '# highlightjs-line-numbers...ions);\n```\n\n---\n© 2017 Yauheni Pakala | MIT License\n', 'encoding': 'utf-8', 'hljs_language': 'markdown', ...}
directory = '317321eb1990086017637d3756ec545fdc8c2d3b'
release = 'eb8cb8546cc99653defe0210350958d496571b74'
revision = 'd82aa99ea4c54710f08a99b8209772e79dfa9cc4'
snapshot = '99ce72dbb2679eb6962ab9bbf85152857bba81a2'
@given(origin(), content(), directory(), release(), revision(), snapshot())
def test_swhid_resolve_success(
api_client, origin, content, directory, release, revision, snapshot
):
for obj_type_short, obj_type, obj_id in (
("cnt", CONTENT, content["sha1_git"]),
("dir", DIRECTORY, directory),
("rel", RELEASE, release),
("rev", REVISION, revision),
("snp", SNAPSHOT, snapshot),
):
swhid = "swh:1:%s:%s;origin=%s" % (obj_type_short, obj_id, origin["url"])
url = reverse("api-1-resolve-swhid", url_args={"swhid": swhid})
resp = api_client.get(url)
if obj_type == CONTENT:
url_args = {"query_string": "sha1_git:%s" % obj_id}
elif obj_type == SNAPSHOT:
url_args = {"snapshot_id": obj_id}
else:
url_args = {"sha1_git": obj_id}
browse_rev_url = reverse(
"browse-%s" % obj_type,
url_args=url_args,
query_params={"origin_url": origin["url"]},
request=resp.wsgi_request,
)
expected_result = {
"browse_url": browse_rev_url,
"metadata": {"origin": origin["url"]},
"namespace": "swh",
"object_id": obj_id,
"object_type": obj_type,
"scheme_version": 1,
}
> assert resp.status_code == 200, resp.data
E AssertionError: {'exception': 'AttributeError', 'reason': "'SWHID' object has no attribute '_asdict'"}
E assert 500 == 200
E +500
E -200
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_identifiers.py:68: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 8 2020, 6:57 PM