Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.deposit.tests.api.test_deposit_binary::test_post_deposit_then_update_refused
Failed

TEST RESULT

Run At
May 28 2020, 1:37 PM
Details
authenticated_client = <rest_framework.test.APIClient object at 0x7f8bcd481898> deposit_collection = <DepositCollection: {'id': 27, 'name': 'test'}> sample_archive = {'data': b'PK\x03\x04\x14\x00\x00\x00\x00\x00\x98\\\xbcP\xcba\xb4c\x14\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00file...ytest-0/test_post_deposit_then_update_0/tmps30y42c7', 'length': 128, 'md5sum': 'f77d810f710e718bae934e48e4b20824', ...} atom_dataset = {'codemeta-sample': '<?xml version="1.0"?>\n <entry xmlns="http://www.w3.org/2005/Atom"\n xmlns:d...ntry>\n', 'entry-data-empty-body': '<?xml version="1.0"?>\n<entry xmlns="http://www.w3.org/2005/Atom"></entry>\n', ...} tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_post_deposit_then_update_0' def test_post_deposit_then_update_refused( authenticated_client, deposit_collection, sample_archive, atom_dataset, tmp_path ): """Updating a deposit with status 'ready' should return a 400 """ tmp_path = str(tmp_path) url = reverse(COL_IRI, args=[deposit_collection.name]) external_id = "some-external-id-1" # when response = authenticated_client.post( url, content_type="application/zip", # as zip data=sample_archive["data"], # + headers CONTENT_LENGTH=sample_archive["length"], HTTP_SLUG=external_id, HTTP_CONTENT_MD5=sample_archive["md5sum"], HTTP_PACKAGING="http://purl.org/net/sword/package/SimpleZip", HTTP_IN_PROGRESS="false", HTTP_CONTENT_DISPOSITION="attachment; filename=filename0", ) # then assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) deposit_id = response_content["deposit_id"] deposit = Deposit.objects.get(pk=deposit_id) assert deposit.status == DEPOSIT_STATUS_DEPOSITED assert deposit.external_id == external_id assert deposit.collection == deposit_collection assert deposit.swh_id is None deposit_request = DepositRequest.objects.get(deposit=deposit) assert deposit_request.deposit == deposit > check_archive("filename0", deposit_request.archive.name) .tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_binary.py:459: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ archive_name = 'filename0', archive_name_to_check = 'client_26/filename0' def check_archive(archive_name: str, archive_name_to_check: str): """Helper function to ensure archive_name is present within the archive_name_to_check. Raises: AssertionError if archive_name is not present within archive_name_to_check """ pattern = re.compile(".*/.*_%s" % archive_name) > assert pattern.match(archive_name_to_check) is not None E AssertionError: assert None is not None E + where None = <built-in method match of re.Pattern object at 0x7f8bcd4a6130>('client_26/filename0') E + where <built-in method match of re.Pattern object at 0x7f8bcd4a6130> = re.compile('.*/.*_filename0').match .tox/py3/lib/python3.7/site-packages/swh/deposit/tests/common.py:137: AssertionError