api_client = <rest_framework.test.APIClient object at 0x7f0e86144ba8>
@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 0x7f0e86144ba8>
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': '10d45e33c688be4d01fe8177928a6d2c36ecdf9d6ab301dc9816ee17310162b4', 'data': '!function(n,e){"use strict...le.error("highlight.js not detected!")}(window,document);', 'encoding': 'us-ascii', 'hljs_language': 'javascript', ...}
directory = '7bc60c56d1762913c221120d42504349e1c45d9f'
release = 'dcd0595fa1e6e94f74d899b56cfced541ddb05c6'
revision = 'a25bcf7a878ad1c4e798eafc683915fad2d847a9'
snapshot = 'a939fc6ac1a445973cd6eecc04e86afd7b46bbfa'
@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': "'dict' object has no attribute 'to_dict'"}
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
- Aug 4 2020, 11:19 AM