def test_cli_collection_error():
mock_client = MagicMock()
mock_client.service_document.return_value = {"error": "something went wrong"}
with pytest.raises(InputError) as e:
> _collection(mock_client)
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
client = <MagicMock id='139903548729832'>
def _collection(client: PublicApiDepositClient) -> str:
"""Retrieve the client's collection
"""
# retrieve user's collection
sd_content = client.service_document()
if "error" in sd_content:
> msg = sd_content["error"]["summary"]
E TypeError: string indices must be integers
.tox/py3/lib/python3.7/site-packages/swh/deposit/cli/client.py:145: TypeError
TEST RESULT
TEST RESULT
- Run At
- Mar 22 2021, 5:49 PM