Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/test_client_module.py
Show All 23 Lines | def test_client_read_data_ok(requests_mock_datadir): | ||||
client = ServiceDocumentDepositClient( | client = ServiceDocumentDepositClient( | ||||
url="https://deposit.swh.test/1", auth=("test", "test") | url="https://deposit.swh.test/1", auth=("test", "test") | ||||
) | ) | ||||
result = client.execute() | result = client.execute() | ||||
assert isinstance(result, dict) | assert isinstance(result, dict) | ||||
collection = result["app:service"]["app:workspace"]["app:collection"] | collection = result["app:service"]["app:workspace"][0]["app:collection"] | ||||
assert collection["sword:name"] == "test" | assert collection["sword:name"] == "test" | ||||
def test_client_read_data_fails(mocker): | def test_client_read_data_fails(mocker): | ||||
mock = mocker.patch("swh.deposit.client.BaseDepositClient.do_execute") | mock = mocker.patch("swh.deposit.client.BaseDepositClient.do_execute") | ||||
mock.side_effect = ValueError("here comes trouble") | mock.side_effect = ValueError("here comes trouble") | ||||
client = ServiceDocumentDepositClient( | client = ServiceDocumentDepositClient( | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |