Various improvements
This commit is contained in:
parent
256fdef129
commit
c15b57ec87
2 changed files with 110 additions and 48 deletions
|
|
@ -155,6 +155,25 @@ class TestFetchTodoListErrors:
|
|||
with pytest.raises(debian_todo.PackageUpdateError) as exc_info:
|
||||
debian_todo.fetch_todo_list()
|
||||
assert "Invalid JSON" in str(exc_info.value)
|
||||
assert "not valid json {" in str(exc_info.value)
|
||||
|
||||
def test_udd_high_load_html_response(self):
|
||||
"""Test known UDD overload HTML response handling."""
|
||||
with patch("debian_todo.urlopen") as mock_urlopen:
|
||||
mock_response = MagicMock()
|
||||
mock_response.read.return_value = (
|
||||
b"<p><b>Current system load (26.1) is too high. "
|
||||
b"Please retry later!</b></p>\n"
|
||||
)
|
||||
mock_response.__enter__ = lambda self: self
|
||||
mock_response.__exit__ = lambda self, *args: None
|
||||
mock_urlopen.return_value = mock_response
|
||||
|
||||
with pytest.raises(debian_todo.PackageUpdateError) as exc_info:
|
||||
debian_todo.fetch_todo_list()
|
||||
|
||||
assert "temporary overload page" in str(exc_info.value)
|
||||
assert "Please retry later" in str(exc_info.value)
|
||||
|
||||
def test_successful_fetch(self):
|
||||
"""Test successful fetch."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue