diff options
Diffstat (limited to 'test/test_api.py')
| -rw-r--r-- | test/test_api.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_api.py b/test/test_api.py index 09b2806..f6ccdf4 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -204,6 +204,15 @@ def locked_package_meta(): </package>""" +@pytest.fixture +def error_status(): + return """<status code="Error"> + <summary>This is the summary</summary> + <details>Here are the details</details> + </status> + """ + + def test_callback(requests_mock): """ Test that api callback works and returns a reference to @@ -218,6 +227,15 @@ def test_callback(requests_mock): assert api.lastapi is api.source +def test_call_status_on_error(requests_mock, error_status): + requests_mock.get(rmock.ANY, text=error_status, status_code=404) + with pytest.raises(Exception): + api.ls() + assert api.call_status.code == "Error" + assert api.call_status.summary == "This is the summary" + assert api.call_status.details == "Here are the details" + + def test_get_project_meta(requests_mock): matcher = prj_meta_re text = '<project/>' |
