summaryrefslogtreecommitdiff
path: root/tests/unit/browser/test_history.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2018-09-01 16:29:38 +0200
committerFlorian Bruhin <me@the-compiler.org>2018-09-01 22:25:22 +0200
commit71a2dad5704d4ed3381e24f54905f53662f82e3a (patch)
tree493902e1a4daea4d1f14760e5f887b0c7e1cd0f9 /tests/unit/browser/test_history.py
parent7fb222464000de15dac945b40712615fd546d9c3 (diff)
downloadqutebrowser-71a2dad5704d4ed3381e24f54905f53662f82e3a.tar.gz
qutebrowser-71a2dad5704d4ed3381e24f54905f53662f82e3a.zip
Add a history.exclude setting
This allows to exclude URL patterns from being displayed in the completion or in qute://history.
Diffstat (limited to 'tests/unit/browser/test_history.py')
-rw-r--r--tests/unit/browser/test_history.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py
index 0f71b0488..6eaa399e7 100644
--- a/tests/unit/browser/test_history.py
+++ b/tests/unit/browser/test_history.py
@@ -221,6 +221,14 @@ class TestAdd:
hist.add_from_tab(QUrl(url), QUrl(req_url), 'title')
assert set(hist) == set(expected)
+ def test_exclude(self, hist, config_stub):
+ """Excluded URLs should be in the history but not completion."""
+ config_stub.set_obj('history.exclude', ['*.example.org'])
+ url = QUrl('http://www.example.org/')
+ hist.add_from_tab(url, url, 'title')
+ assert list(hist)
+ assert not list(hist.completion)
+
class TestHistoryInterface:
@@ -472,6 +480,21 @@ class TestRebuild:
]
assert not hist3.metainfo['force_rebuild']
+ def test_exclude(self, config_stub, hist):
+ """Ensure that patterns in history.exclude are ignored."""
+ config_stub.set_obj('history.exclude', ['*.example.org'])
+ assert hist.metainfo['force_rebuild']
+
+ hist.add_url(QUrl('http://example.com'), redirect=False, atime=1)
+ hist.add_url(QUrl('http://example.org'), redirect=False, atime=2)
+
+ hist2 = history.WebHistory()
+ 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)
+ assert not hist.metainfo['force_rebuild']
+
class TestCompletionMetaInfo: