summaryrefslogtreecommitdiff
path: root/tests/unit/browser/test_history.py
diff options
context:
space:
mode:
authorJay Kamat <jaygkamat@gmail.com>2019-04-03 23:06:25 -0700
committerJay Kamat <jaygkamat@gmail.com>2019-04-03 23:17:23 -0700
commit07c688406644a64f8de2e57df98d170123ccea1a (patch)
tree893fac3b17791d31df6570d122c3d9f98b713d80 /tests/unit/browser/test_history.py
parent31c17d758ab0e97a49042dd9b2beec34b1aa6a5f (diff)
downloadqutebrowser-07c688406644a64f8de2e57df98d170123ccea1a.tar.gz
qutebrowser-07c688406644a64f8de2e57df98d170123ccea1a.zip
Ignore duplicate consecutive history entries from the same url
Diffstat (limited to 'tests/unit/browser/test_history.py')
-rw-r--r--tests/unit/browser/test_history.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py
index 4e3120796..2afcd9181 100644
--- a/tests/unit/browser/test_history.py
+++ b/tests/unit/browser/test_history.py
@@ -117,6 +117,9 @@ class TestDelete:
web_history.clear(force=True)
assert not len(web_history)
assert not len(web_history.completion)
+ web_history.add_url(QUrl('http://www.qutebrowser.org/'))
+ assert len(web_history)
+ assert len(web_history.completion)
@pytest.mark.parametrize('raw, escaped', [
('http://example.com/1', 'http://example.com/1'),
@@ -139,6 +142,11 @@ class TestDelete:
set(web_history.completion))
assert completion_diff == {(raw, '', 0)}
+ # ensure we can add the url back
+ web_history.add_url(QUrl(raw), atime=0)
+ assert before == set(web_history)
+ assert completion_before == set(web_history.completion)
+
class TestAdd:
@@ -229,6 +237,18 @@ class TestAdd:
assert list(web_history)
assert not list(web_history.completion)
+ def test_no_immedate_duplicates(self, web_history, caplog, mock_time, mocker):
+ m = mocker.patch('qutebrowser.browser.history.WebHistory.add_url')
+ url = QUrl("http://example.com")
+ url2 = QUrl("http://example2.com")
+ web_history.add_from_tab(QUrl(url), QUrl(url), 'title')
+ m.assert_called_once()
+ m.reset_mock()
+ web_history.add_from_tab(QUrl(url), QUrl(url), 'title')
+ m.assert_not_called()
+ web_history.add_from_tab(QUrl(url2), QUrl(url2), 'title')
+ m.assert_called_once()
+
class TestHistoryInterface: