Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.api.views.test_graph::Tests / Python tests / test_graph_response_resolve_origins
Failed

TEST RESULT

Run At
May 25 2022, 4:46 PM
Details
archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f45e42a7860> api_client = <rest_framework.test.APIClient object at 0x7f45e42a7cc0> keycloak_oidc = <swh.auth.pytest_plugin.KeycloackOpenIDConnectMock object at 0x7f45e42a75c0> requests_mock = <requests_mock.mocker.Mocker object at 0x7f45e4059390> origin = {'archives': ['highlightjs-line-numbers.js.zip', 'highlightjs-line-numbers.js_visit2.zip'], 'id': b'MZ\xc0H_lE[d\xcc\x...s://doi.org/10.5063/schema/codemeta-2.0', 'description': 'Line numbering plugin for Highlight.js'}, 'type': 'git', ...} def test_graph_response_resolve_origins( archive_data, api_client, keycloak_oidc, requests_mock, origin ): hasher = hashlib.sha1() hasher.update(origin["url"].encode()) origin_sha1 = hasher.digest() origin_swhid = str( ExtendedSWHID(object_type=ExtendedObjectType.ORIGIN, object_id=origin_sha1) ) snapshot = archive_data.snapshot_get_latest(origin["url"])["id"] snapshot_swhid = str( ExtendedSWHID( object_type=ExtendedObjectType.SNAPSHOT, object_id=hash_to_bytes(snapshot) ) ) _authenticate_graph_user(api_client, keycloak_oidc) for graph_query, response_text, content_type in ( ( f"visit/nodes/{snapshot_swhid}", f"{snapshot_swhid}\n{origin_swhid}\n", "text/plain", ), ( f"visit/edges/{snapshot_swhid}", f"{snapshot_swhid} {origin_swhid}\n", "text/plain", ), ( f"visit/paths/{snapshot_swhid}", f'["{snapshot_swhid}", "{origin_swhid}"]\n', "application/x-ndjson", ), ): # set two lines response to check resolved origins cache response_text = response_text + response_text requests_mock.get( get_config()["graph"]["server_url"] + graph_query, text=response_text, headers={"Content-Type": content_type, "Transfer-Encoding": "chunked"}, ) url = reverse( "api-1-graph", url_args={"graph_query": graph_query}, query_params={"direction": "backward"}, ) > resp = check_http_get_response(api_client, url, status_code=200) .tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_graph.py:221: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ client = <rest_framework.test.APIClient object at 0x7f45e42a7cc0> url = '/api/1/graph/visit/nodes/swh:1:snp:da8abf3ec5203afa1561754a041aca64d7580ec2/?direction=backward' status_code = 200, content_type = '*/*', 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(<django.http.response.StreamingHttpResponse object at 0x7f45e4105a90>, Response) .tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:66: AssertionError