Page MenuHomeSoftware Heritage

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

TEST RESULT

Run At
Apr 23 2021, 11:26 AM
Details
api_client = <rest_framework.test.APIClient object at 0x7f3fab1bcb00> keycloak_oidc = <swh.auth.pytest_plugin.KeycloackOpenIDConnectMock object at 0x7f3fab5ab588> requests_mock = <requests_mock.mocker.Mocker object at 0x7f3fab321ef0> def test_graph_endpoint_needs_permission(api_client, keycloak_oidc, requests_mock): graph_query = "stats" url = reverse("api-1-graph", url_args={"graph_query": graph_query}) oidc_profile = keycloak_oidc.login() api_client.credentials(HTTP_AUTHORIZATION=f"Bearer {oidc_profile['refresh_token']}") check_http_get_response(api_client, url, status_code=403) _authenticate_graph_user(api_client, keycloak_oidc) requests_mock.get( get_config()["graph"]["server_url"] + graph_query, json={}, headers={"Content-Type": "application/json"}, ) > 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:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:66: in check_http_get_response content_type=content_type, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ response = <Response status_code=403, "text/plain; charset=utf-8"> status_code = 200, content_type = '*/*' def _assert_http_response( response: HttpResponse, status_code: int, content_type: str ) -> HttpResponse: if isinstance(response, Response): drf_response = cast(Response, response) error_context = ( drf_response.data.pop("traceback") if isinstance(drf_response.data, dict) and "traceback" in drf_response.data else drf_response.data ) elif isinstance(response, StreamingHttpResponse): error_context = getattr(response, "traceback", response.streaming_content) else: error_context = getattr(response, "traceback", response.content) > assert response.status_code == status_code, error_context E AssertionError: You do not have permission to perform this action. E assert 403 == 200 E +403 E -200 .tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:32: AssertionError