Use config_stub.val instead of config_stub.set_obj in tests

This commit is contained in:
Florian Bruhin 2018-09-02 10:30:26 +02:00
parent dbdeb6a9c7
commit b0185e3c8a
4 changed files with 6 additions and 8 deletions

View File

@ -429,7 +429,7 @@ def test_config_change(config_stub, basedir, download_stub,
host_blocker = adblock.HostBlocker()
host_blocker.read_hosts()
config_stub.set_obj('content.host_blocking.lists', None)
config_stub.val.content.host_blocking.lists = None
host_blocker.read_hosts()
for str_url in URLS_TO_CHECK:
assert not host_blocker.is_blocked(QUrl(str_url))

View File

@ -226,8 +226,7 @@ class TestAdd:
def test_exclude(self, hist, config_stub):
"""Excluded URLs should be in the history but not completion."""
config_stub.set_obj('completion.web_history.exclude',
['*.example.org'])
config_stub.val.completion.web_history.exclude = ['*.example.org']
url = QUrl('http://www.example.org/')
hist.add_from_tab(url, url, 'title')
assert list(hist)
@ -489,8 +488,7 @@ class TestRebuild:
This setting should only be used for the completion.
"""
config_stub.set_obj('completion.web_history.exclude',
['*.example.org'])
config_stub.val.completion.web_history.exclude = ['*.example.org']
assert hist.metainfo['force_rebuild']
hist.add_url(QUrl('http://example.com'), redirect=False, atime=1)
@ -500,7 +498,7 @@ class TestRebuild:
assert list(hist2.completion) == [('http://example.com', '', 1)]
def test_unrelated_config_change(self, config_stub, hist):
config_stub.set_obj('history_gap_interval', 1234)
config_stub.val.history_gap_interval = 1234
assert not hist.metainfo['force_rebuild']

View File

@ -136,7 +136,7 @@ class TestHistoryHandler:
def test_exclude(self, fake_web_history, now, config_stub):
"""Make sure the completion.web_history.exclude setting is not used."""
config_stub.set_obj('completion.web_history.exclude', ['www.x.com'])
config_stub.val.completion.web_history.exclude = ['www.x.com']
url = QUrl("qute://history/data?start_time={}".format(now))
_mimetype, data = qutescheme.qute_history(url)

View File

@ -81,7 +81,7 @@ def test_changing_timer_with_messages_shown(qtbot, view, config_stub):
config_stub.val.messages.timeout = 900000 # 15s
view.show_message(usertypes.MessageLevel.info, 'test')
with qtbot.waitSignal(view._clear_timer.timeout):
config_stub.set_obj('messages.timeout', 100)
config_stub.val.messages.timeout = 100
@pytest.mark.parametrize('count, expected', [(1, 100), (3, 300),