Use config_stub.val instead of config_stub.set_obj in tests
This commit is contained in:
parent
dbdeb6a9c7
commit
b0185e3c8a
@ -429,7 +429,7 @@ def test_config_change(config_stub, basedir, download_stub,
|
|||||||
|
|
||||||
host_blocker = adblock.HostBlocker()
|
host_blocker = adblock.HostBlocker()
|
||||||
host_blocker.read_hosts()
|
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()
|
host_blocker.read_hosts()
|
||||||
for str_url in URLS_TO_CHECK:
|
for str_url in URLS_TO_CHECK:
|
||||||
assert not host_blocker.is_blocked(QUrl(str_url))
|
assert not host_blocker.is_blocked(QUrl(str_url))
|
||||||
|
@ -226,8 +226,7 @@ class TestAdd:
|
|||||||
|
|
||||||
def test_exclude(self, hist, config_stub):
|
def test_exclude(self, hist, config_stub):
|
||||||
"""Excluded URLs should be in the history but not completion."""
|
"""Excluded URLs should be in the history but not completion."""
|
||||||
config_stub.set_obj('completion.web_history.exclude',
|
config_stub.val.completion.web_history.exclude = ['*.example.org']
|
||||||
['*.example.org'])
|
|
||||||
url = QUrl('http://www.example.org/')
|
url = QUrl('http://www.example.org/')
|
||||||
hist.add_from_tab(url, url, 'title')
|
hist.add_from_tab(url, url, 'title')
|
||||||
assert list(hist)
|
assert list(hist)
|
||||||
@ -489,8 +488,7 @@ class TestRebuild:
|
|||||||
|
|
||||||
This setting should only be used for the completion.
|
This setting should only be used for the completion.
|
||||||
"""
|
"""
|
||||||
config_stub.set_obj('completion.web_history.exclude',
|
config_stub.val.completion.web_history.exclude = ['*.example.org']
|
||||||
['*.example.org'])
|
|
||||||
assert hist.metainfo['force_rebuild']
|
assert hist.metainfo['force_rebuild']
|
||||||
|
|
||||||
hist.add_url(QUrl('http://example.com'), redirect=False, atime=1)
|
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)]
|
assert list(hist2.completion) == [('http://example.com', '', 1)]
|
||||||
|
|
||||||
def test_unrelated_config_change(self, config_stub, hist):
|
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']
|
assert not hist.metainfo['force_rebuild']
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class TestHistoryHandler:
|
|||||||
|
|
||||||
def test_exclude(self, fake_web_history, now, config_stub):
|
def test_exclude(self, fake_web_history, now, config_stub):
|
||||||
"""Make sure the completion.web_history.exclude setting is not used."""
|
"""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))
|
url = QUrl("qute://history/data?start_time={}".format(now))
|
||||||
_mimetype, data = qutescheme.qute_history(url)
|
_mimetype, data = qutescheme.qute_history(url)
|
||||||
|
@ -81,7 +81,7 @@ def test_changing_timer_with_messages_shown(qtbot, view, config_stub):
|
|||||||
config_stub.val.messages.timeout = 900000 # 15s
|
config_stub.val.messages.timeout = 900000 # 15s
|
||||||
view.show_message(usertypes.MessageLevel.info, 'test')
|
view.show_message(usertypes.MessageLevel.info, 'test')
|
||||||
with qtbot.waitSignal(view._clear_timer.timeout):
|
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),
|
@pytest.mark.parametrize('count, expected', [(1, 100), (3, 300),
|
||||||
|
Loading…
Reference in New Issue
Block a user