api_client = <rest_framework.test.APIClient object at 0x7f45e4042390>
content = {'blake2s256': '9e2e70e62b9211ec89791514874f8384079477db569dac57c4e57417f8dc92c6', 'data': '{\n "name": "highlightjs-...",\n "bower_components",\n "test",\n "tests"\n ]\n}\n', 'encoding': 'us-ascii', 'hljs_language': 'json', ...}
directory = 'a1995b288f3c48c18d90ce57bb8372fa9cc3287b'
origin = {'archives': ['libtess2.zip'], 'id': b'\x0fH`\x80Q\x0eN\xeb\x98\xbe\x0c\xc8k\xa8\x06\xc0\xc7>\xe8\xa2', 'metadata': {'...ma/codemeta-2.0', 'description': 'Game and tools oriented refactored version of GLU tessellator.'}, 'type': 'git', ...}
release = 'dcd0595fa1e6e94f74d899b56cfced541ddb05c6'
revision = '42e7f3f4db6811ae4a307986ff6c9ac2475bfa91'
snapshot = 'a939fc6ac1a445973cd6eecc04e86afd7b46bbfa'
def test_swhid_resolve_success(
api_client, content, directory, origin, release, revision, snapshot
):
for obj_type, obj_id in (
(ObjectType.CONTENT, content["sha1_git"]),
(ObjectType.DIRECTORY, directory),
(ObjectType.RELEASE, release),
(ObjectType.REVISION, revision),
(ObjectType.SNAPSHOT, snapshot),
):
swhid = gen_swhid(obj_type, obj_id, metadata={"origin": origin["url"]})
url = reverse("api-1-resolve-swhid", url_args={"swhid": swhid})
> resp = check_api_get_responses(api_client, url, status_code=200)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_identifiers.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:131: in check_api_get_responses
check_http_get_response(api_client, url, status_code, content_type="text/html")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
client = <rest_framework.test.APIClient object at 0x7f45e4042390>
url = '/api/1/resolve/swh:1:cnt:52d4fb58d9674990b7b22b8b33cd1870fe362c73;origin=https://github.com/memononen/libtess2/'
status_code = 200, content_type = 'text/html', http_origin = None
server_name = None
def check_http_get_response(
client: Client,
url: str,
status_code: int,
content_type: str = "*/*",
http_origin: Optional[str] = None,
server_name: Optional[str] = None,
) -> HttpResponse:
"""Helper function to check HTTP response for a GET request.
Args:
client: Django test client
url: URL to check response
status_code: expected HTTP status code
content_type: expected response content type
http_origin: optional HTTP_ORIGIN header value
Returns:
The HTTP response
"""
actual_response = client.get(
url,
HTTP_ACCEPT=content_type,
HTTP_ORIGIN=http_origin,
SERVER_NAME=server_name if server_name else "testserver",
)
> assert isinstance(actual_response, Response)
E assert False
E + where False = isinstance(<HttpResponse status_code=200, "text/html; charset=utf-8">, Response)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:66: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 25 2022, 4:46 PM