summaryrefslogtreecommitdiff
path: root/tests/unit/completion/test_models.py
diff options
context:
space:
mode:
authorJimmy <jimmy@spalge.com>2018-09-11 20:17:17 +1200
committerJimmy <jimmy@spalge.com>2020-02-13 21:02:24 +1300
commitc85d0e032a25e8f4d6e8a7cbbcda034a2e3428c2 (patch)
tree1d7339fa5f0c99818d489833a58d8532e8109ebf /tests/unit/completion/test_models.py
parentf157577da4d2105ee3f7cab5eb1a932e08348c44 (diff)
downloadqutebrowser-c85d0e032a25e8f4d6e8a7cbbcda034a2e3428c2.tar.gz
qutebrowser-c85d0e032a25e8f4d6e8a7cbbcda034a2e3428c2.zip
Add last visited time to :back/:forward completion.
Diffstat (limited to 'tests/unit/completion/test_models.py')
-rw-r--r--tests/unit/completion/test_models.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py
index ffcd615d2..8d1bd3467 100644
--- a/tests/unit/completion/test_models.py
+++ b/tests/unit/completion/test_models.py
@@ -22,11 +22,12 @@
import collections
import random
import string
+import time
from datetime import datetime
from unittest import mock
import pytest
-from PyQt5.QtCore import QUrl
+from PyQt5.QtCore import QUrl, QDateTime
try:
from PyQt5.QtWebEngineWidgets import (
QWebEngineHistory, QWebEngineHistoryItem
@@ -1164,16 +1165,18 @@ def tab_with_history(fake_web_tab, tabbed_browser_stubs, info, monkeypatch):
)
history = []
- for url, title in [
- ("http://example.com/index", "list of things"),
- ("http://example.com/thing1", "thing1 detail"),
- ("http://example.com/thing2", "thing2 detail"),
- ("http://example.com/thing3", "thing3 detail"),
- ("http://example.com/thing4", "thing4 detail"),
+ now = time.time()
+ for url, title, ts in [
+ ("http://example.com/index", "list of things", now),
+ ("http://example.com/thing1", "thing1 detail", now+5),
+ ("http://example.com/thing2", "thing2 detail", now+10),
+ ("http://example.com/thing3", "thing3 detail", now+15),
+ ("http://example.com/thing4", "thing4 detail", now+20),
]:
entry = mock.Mock(spec=QWebEngineHistoryItem)
entry.url.return_value = QUrl(url)
entry.title.return_value = title
+ entry.lastVisited.return_value = QDateTime.fromSecsSinceEpoch(ts)
history.append(entry)
tab.history._history = mock.Mock(spec=QWebEngineHistory)
tab.history._history.items.return_value = history