summaryrefslogtreecommitdiff
path: root/tests/unit/browser/test_history.py
diff options
context:
space:
mode:
authorJay Kamat <jaygkamat@gmail.com>2019-04-06 00:49:41 -0700
committerJay Kamat <jaygkamat@gmail.com>2019-04-06 14:46:50 -0700
commite76be23646e0be845333438b8ec255fd7ffe200b (patch)
tree21532b41552f01620b6300fdab09b97853d7357b /tests/unit/browser/test_history.py
parent07c688406644a64f8de2e57df98d170123ccea1a (diff)
downloadqutebrowser-e76be23646e0be845333438b8ec255fd7ffe200b.tar.gz
qutebrowser-e76be23646e0be845333438b8ec255fd7ffe200b.zip
Make last_url private
Diffstat (limited to 'tests/unit/browser/test_history.py')
-rw-r--r--tests/unit/browser/test_history.py39
1 files changed, 25 insertions, 14 deletions
diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py
index 2afcd9181..738ba6c13 100644
--- a/tests/unit/browser/test_history.py
+++ b/tests/unit/browser/test_history.py
@@ -117,9 +117,6 @@ 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'),
@@ -142,11 +139,6 @@ 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:
@@ -237,17 +229,36 @@ 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')
+ def test_no_immedate_duplicates(self, web_history, mock_time):
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()
+ hist = list(web_history)
+ assert list(web_history)
web_history.add_from_tab(QUrl(url), QUrl(url), 'title')
- m.assert_not_called()
+ assert list(web_history) == hist
web_history.add_from_tab(QUrl(url2), QUrl(url2), 'title')
- m.assert_called_once()
+ assert len(list(web_history)) != hist
+
+ def test_delete_add_tab(self, web_history, mock_time):
+ url = QUrl("http://example.com")
+ web_history.add_from_tab(QUrl(url), QUrl(url), 'title')
+ hist = list(web_history)
+ assert list(web_history)
+ web_history.delete_url(QUrl(url))
+ assert len(web_history) == 0
+ web_history.add_from_tab(QUrl(url), QUrl(url), 'title')
+ assert list(web_history) == hist
+
+ def test_clear_add_tab(self, web_history, mock_time):
+ url = QUrl("http://example.com")
+ web_history.add_from_tab(QUrl(url), QUrl(url), 'title')
+ hist = list(web_history)
+ assert list(web_history)
+ web_history.clear(force=True)
+ assert len(web_history) == 0
+ web_history.add_from_tab(QUrl(url), QUrl(url), 'title')
+ assert list(web_history) == hist
class TestHistoryInterface: