Fix testing with error pastebin_version()

This commit is contained in:
George Edward Bulmer 2018-02-13 14:49:15 +00:00
parent 942dca3444
commit e349af7524

View File

@ -1001,7 +1001,7 @@ def test_pastebin_version(pbclient, monkeypatch):
assert version.pastebin_url == "test"
def test_pastebin_version_error(pbclient, monkeypatch):
def test_pastebin_version_error(pbclient, caplog, monkeypatch):
"""Test version.pastebin_version() with errors."""
patches = {
'_path_info': lambda: {'PATH DESC': 'PATH NAME'},
@ -1012,8 +1012,8 @@ def test_pastebin_version_error(pbclient, monkeypatch):
monkeypatch.setattr('qutebrowser.utils.version.' + name, val)
version.pastebin_url = None
version.pastebin_version(pbclient)
try:
pbclient.error.emit("test")
except:
assert version.pastebin_url is None
with caplog.at_level(logging.ERROR):
version.pastebin_version(pbclient)
pbclient._client.error.emit("test")
assert version.pastebin_url is None
assert caplog.records[0].message == "Failed to pastebin version info: test"