Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.admin.test_deposit::Tests / Python tests / test_deposit_admin_view_list_deposits
Failed

TEST RESULT

Run At
May 25 2022, 4:46 PM
Details
client = <django.test.client.Client object at 0x7f45e4d37eb8> staff_user = <User: admin> requests_mock = <requests_mock.mocker.Mocker object at 0x7f45e4daacc0> @pytest.mark.django_db def test_deposit_admin_view_list_deposits(client, staff_user, requests_mock): deposits_data = { "data": [ { "external_id": "hal-02527986", "id": 1066, "raw_metadata": None, "reception_date": "2022-04-08T14:12:34.143000Z", "status": "rejected", "status_detail": None, "swhid": None, "swhid_context": None, "type": "code", "uri": "https://inria.halpreprod.archives-ouvertes.fr/hal-02527986", }, { "external_id": "hal-01243573", "id": 1065, "raw_metadata": None, "reception_date": "2022-04-08T12:53:50.940000Z", "status": "rejected", "status_detail": None, "swhid": None, "swhid_context": None, "type": "code", "uri": "https://inria.halpreprod.archives-ouvertes.fr/hal-01243573", }, ], "draw": 2, "recordsFiltered": 645, "recordsTotal": 1066, } config = get_config()["deposit"] private_api_url = config["private_api_url"].rstrip("/") + "/" deposits_list_url = private_api_url + "deposits/datatables/" basic_auth_payload = ( config["private_api_user"] + ":" + config["private_api_password"] ).encode() requests_mock.get( deposits_list_url, json=deposits_data, request_headers={ "Authorization": f"Basic {b64encode(basic_auth_payload).decode('ascii')}" }, ) client.force_login(staff_user) url = reverse("admin-deposit-list") check_http_get_response( > client, url, status_code=200, content_type="application/json" ) .tox/py3/lib/python3.7/site-packages/swh/web/tests/admin/test_deposit.py:100: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ client = <django.test.client.Client object at 0x7f45e4d37eb8> url = '/admin/deposit/list/', status_code = 200 content_type = 'application/json', 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(<JsonResponse status_code=200, "application/json">, Response) .tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:66: AssertionError