self = <swh.storage.tests.test_api_client.TestStorage object at 0x7fd8027b08d0>
swh_storage = <RemoteStorage url=mock://example.com/>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7fd8028b1160>
def test_origin_visit_status_get_all(self, swh_storage, sample_data):
origin = sample_data.origin
swh_storage.origin_add([origin])
date_visit3 = round_to_milliseconds(now())
date_visit1 = date_visit3 - datetime.timedelta(hours=2)
date_visit2 = date_visit3 - datetime.timedelta(hours=1)
assert date_visit1 < date_visit2
assert date_visit2 < date_visit3
ov1 = swh_storage.origin_visit_add(
[
OriginVisit(
origin=origin.url, date=date_visit1, type=sample_data.type_visit1,
),
]
)[0]
ovs1 = OriginVisitStatus(
origin=origin.url,
visit=ov1.visit,
date=date_visit1,
status="created",
snapshot=None,
)
ovs2 = OriginVisitStatus(
origin=origin.url,
visit=ov1.visit,
date=date_visit2,
status="partial",
snapshot=None,
)
ovs3 = OriginVisitStatus(
origin=origin.url,
visit=ov1.visit,
date=date_visit3,
status="full",
snapshot=sample_data.snapshot.id,
metadata={},
)
swh_storage.origin_visit_status_add([ovs2, ovs3])
# order asc, no pagination, no limit
> actual_page = swh_storage.origin_visit_status_get(origin.url, ov1.visit)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1398:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py:181: in meth_
return self.post(meth._endpoint_path, post_data)
.tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py:278: in post
return self._decode_response(response)
.tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py:352: in _decode_response
self.raise_for_status(response)
.tox/py3/lib/python3.7/site-packages/swh/storage/api/client.py:30: in raise_for_status
super().raise_for_status(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <RemoteStorage url=mock://example.com/>, response = <Response [500]>
def raise_for_status(self, response) -> None:
"""check response HTTP status code and raise an exception if it denotes an
error; do nothing otherwise
"""
status_code = response.status_code
status_class = response.status_code // 100
if status_code == 404:
raise RemoteException(payload="404 not found", response=response)
exception = None
# TODO: only old servers send pickled error; stop trying to unpickle
# after they are all upgraded
try:
if status_class == 4:
data = self._decode_response(response, check_status=False)
if isinstance(data, dict):
for exc_type in self.reraise_exceptions:
if exc_type.__name__ == data["exception"]["type"]:
exception = exc_type(*data["exception"]["args"])
break
else:
exception = RemoteException(
payload=data["exception"], response=response
)
else:
exception = pickle.loads(data)
elif status_class == 5:
data = self._decode_response(response, check_status=False)
if "exception_pickled" in data:
exception = pickle.loads(data["exception_pickled"])
else:
exception = RemoteException(
payload=data["exception"], response=response
)
except (TypeError, pickle.UnpicklingError):
raise RemoteException(payload=data, response=response)
if exception:
> raise exception from None
E swh.core.api.RemoteException: <RemoteException 500 AttributeError: ["'InMemoryStorage' object has no attribute 'origin_visit_status_get'"]>
.tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py:342: RemoteException
TEST RESULT
TEST RESULT
- Run At
- Jul 29 2020, 4:45 PM