tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_add_archive_to_deposit_is0'
authenticated_client = <rest_framework.test.APIClient object at 0x7f8bcdb58470>
deposit_collection = <DepositCollection: {'id': 77, 'name': 'test'}>
partial_deposit_with_metadata = <Deposit: {'id': 64, 'reception_date': datetime.datetime(2020, 5, 28, 11, 37, 21, 909364, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-partial', 'client': 'test', 'status': 'partial'}>
sample_archive = {'data': b'PK\x03\x04\x14\x00\x00\x00\x00\x00\xaa\\\xbcP\xcba\xb4c\x14\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00file...ytest-0/test_add_archive_to_deposit_is0/tmpll9xgboq', 'length': 128, 'md5sum': '4ec3a18f0f7f8ccc181b941b3e515de4', ...}
def test_add_archive_to_deposit_is_possible(
tmp_path,
authenticated_client,
deposit_collection,
partial_deposit_with_metadata,
sample_archive,
):
"""Add another archive to a deposit return a 201 response
"""
tmp_path = str(tmp_path)
deposit = partial_deposit_with_metadata
requests = DepositRequest.objects.filter(deposit=deposit, type="archive")
assert len(requests) == 1
> check_archive(sample_archive["name"], requests[0].archive.name)
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_update.py:144:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
archive_name = 'archive1.zip', archive_name_to_check = 'client_76/archive1.zip'
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 0x7f8bcd73e378>('client_76/archive1.zip')
E + where <built-in method match of re.Pattern object at 0x7f8bcd73e378> = re.compile('.*/.*_archive1.zip').match
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/common.py:137: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 28 2020, 1:37 PM