authenticated_client = <rest_framework.test.APIClient object at 0x7fa66ea940b8>
deposit_collection = <DepositCollection: {'id': 54, 'name': 'test'}>
complete_deposit = <Deposit: {'id': 42, 'reception_date': datetime.datetime(2020, 9, 17, 17, 49, 28, 392956, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-complete', 'client': 'test', 'status': 'done'}>
sample_archive = {'data': b'PK\x03\x04\x14\x00\x00\x00\x00\x00.\x8e1Q\xcba\xb4c\x14\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00file1som...ytest-0/test_access_to_existing_deposi0/tmpssb6i8ce', 'length': 128, 'md5sum': '39e8bd65bf8f0eb04eeed3f16943a4e9', ...}
def test_access_to_existing_deposit_with_one_archive(
authenticated_client, deposit_collection, complete_deposit, sample_archive
):
"""Access to deposit should stream a 200 response with its raw content
"""
deposit = complete_deposit
for url in private_get_raw_url_endpoints(deposit_collection, deposit):
> r = authenticated_client.get(url)
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_private_read_archive.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/rest_framework/test.py:286: in get
response = super().get(path, data=data, **extra)
.tox/py3/lib/python3.7/site-packages/rest_framework/test.py:203: in get
return self.generic('GET', path, **r)
.tox/py3/lib/python3.7/site-packages/rest_framework/test.py:232: in generic
method, path, data, content_type, secure, **extra)
.tox/py3/lib/python3.7/site-packages/django/test/client.py:422: in generic
return self.request(**r)
.tox/py3/lib/python3.7/site-packages/rest_framework/test.py:283: in request
return super().request(**kwargs)
.tox/py3/lib/python3.7/site-packages/rest_framework/test.py:235: in request
request = super().request(**kwargs)
.tox/py3/lib/python3.7/site-packages/django/test/client.py:503: in request
raise exc_value
.tox/py3/lib/python3.7/site-packages/django/core/handlers/exception.py:34: in inner
response = get_response(request)
.tox/py3/lib/python3.7/site-packages/django/core/handlers/base.py:115: in _get_response
response = self.process_exception_by_middleware(e, request)
.tox/py3/lib/python3.7/site-packages/django/core/handlers/base.py:113: in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
.tox/py3/lib/python3.7/site-packages/django/views/decorators/csrf.py:54: in wrapped_view
return view_func(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/django/views/generic/base.py:71: in view
return self.dispatch(request, *args, **kwargs)
.tox/py3/lib/python3.7/site-packages/rest_framework/views.py:505: in dispatch
response = self.handle_exception(exc)
.tox/py3/lib/python3.7/site-packages/rest_framework/views.py:465: in handle_exception
self.raise_uncaught_exception(exc)
.tox/py3/lib/python3.7/site-packages/rest_framework/views.py:476: in raise_uncaught_exception
raise exc
.tox/py3/lib/python3.7/site-packages/rest_framework/views.py:502: in dispatch
response = handler(request, *args, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/deposit/api/private/__init__.py:91: in get
return super().get(request, collection_name, deposit_id)
.tox/py3/lib/python3.7/site-packages/swh/deposit/api/common.py:860: in get
return FileResponse(content, status=status, content_type=content_type)
.tox/py3/lib/python3.7/site-packages/django/http/response.py:399: in __init__
super().__init__(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/django/http/response.py:360: in __init__
self.streaming_content = streaming_content
.tox/py3/lib/python3.7/site-packages/django/http/response.py:375: in streaming_content
self._set_streaming_content(value)
.tox/py3/lib/python3.7/site-packages/django/http/response.py:410: in _set_streaming_content
self.set_headers(filelike)
.tox/py3/lib/python3.7/site-packages/django/http/response.py:426: in set_headers
self['Content-Length'] = os.path.getsize(filelike.name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = '/tmp/swh-deposit/test/extraction-dir/swh.deposit-vf17w6mh/aggregate.zip'
def getsize(filename):
"""Return the size of a file, reported by os.stat()."""
> return os.stat(filename).st_size
E FileNotFoundError: [Errno 2] No such file or directory: '/tmp/swh-deposit/test/extraction-dir/swh.deposit-vf17w6mh/aggregate.zip'
/usr/lib/python3.7/genericpath.py:50: FileNotFoundError
TEST RESULT
TEST RESULT
- Run At
- Sep 17 2020, 7:50 PM