api_client = <rest_framework.test.APIClient object at 0x7f3fab1bcb00>
keycloak_oidc = <swh.auth.pytest_plugin.KeycloackOpenIDConnectMock object at 0x7f3fab443710>
requests_mock = <requests_mock.mocker.Mocker object at 0x7f3fab042198>
def test_graph_json_response(api_client, keycloak_oidc, requests_mock):
_authenticate_graph_user(api_client, keycloak_oidc)
graph_query = "stats"
requests_mock.get(
get_config()["graph"]["server_url"] + graph_query,
json=_response_json,
headers={"Content-Type": "application/json"},
)
url = reverse("api-1-graph", url_args={"graph_query": graph_query})
> 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:130:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.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
TEST RESULT
TEST RESULT
- Run At
- Apr 23 2021, 11:26 AM