Don't bother mocking a history entry.
Use webkit.history.Entry in tests instead of FakeHistoryEntry.
This commit is contained in:
parent
f50b8bb8e8
commit
ee59b133c0
@ -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):
|
||||
|
@ -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')),
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user