diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index 752a41cd8..78f134051 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -29,7 +29,7 @@ from PyQt5.QtNetwork import (QNetworkRequest, QAbstractNetworkCache, QNetworkCacheMetaData) from PyQt5.QtWidgets import QCommonStyle, QWidget -from qutebrowser.browser.webkit import webview +from qutebrowser.browser.webkit import webview, history from qutebrowser.config import configexc from qutebrowser.mainwindow import mainwindow @@ -452,17 +452,6 @@ class KeyConfigStub: self.bindings[section] = bindings -class FakeHistoryEntry: - - """Mock for webkit.history.Entry.""" - - def __init__(self, atime, url, title, redirect=False): - self.atime = float(atime) - self.url = url - self.title = title - self.redirect = redirect - - class UrlMarkManagerStub(QObject): """Stub for the quickmark-manager or bookmark-manager object.""" @@ -498,7 +487,7 @@ class WebHistoryStub(QObject): """Stub for the web-history object.""" - add_completion_item = pyqtSignal(FakeHistoryEntry) + add_completion_item = pyqtSignal(history.Entry) cleared = pyqtSignal() def __init__(self, parent=None): diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py index 7c7e2c4f7..1c39b6ea2 100644 --- a/tests/unit/completion/test_models.py +++ b/tests/unit/completion/test_models.py @@ -27,6 +27,7 @@ from PyQt5.QtCore import QUrl from PyQt5.QtWidgets import QTreeView from qutebrowser.completion.models import miscmodels, urlmodel, configmodel +from qutebrowser.browser.webkit import history @pytest.fixture @@ -55,13 +56,13 @@ def bookmarks(bookmark_manager_stub): def web_history(stubs, web_history_stub): """Pre-populate the web-history stub with some history entries.""" web_history_stub.history_dict = collections.OrderedDict([ - ('http://qutebrowser.org', stubs.FakeHistoryEntry( + ('http://qutebrowser.org', history.Entry( datetime(2015, 9, 5).timestamp(), QUrl('http://qutebrowser.org'), 'qutebrowser | qutebrowser')), - ('https://python.org', stubs.FakeHistoryEntry( + ('https://python.org', history.Entry( datetime(2016, 3, 8).timestamp(), QUrl('https://python.org'), 'Welcome to Python.org')), - ('https://github.com', stubs.FakeHistoryEntry( + ('https://github.com', history.Entry( datetime(2016, 5, 1).timestamp(), QUrl('https://github.com'), 'GitHub')), ])