parent
57b7b43802
commit
777e3f58e1
@ -22,7 +22,6 @@
|
||||
import unittest
|
||||
|
||||
from PyQt5.QtCore import QUrl, QPoint
|
||||
from PyQt5.QtWebKitWidgets import QWebPage
|
||||
|
||||
from qutebrowser.browser import tabhistory
|
||||
from qutebrowser.browser.tabhistory import TabHistoryItem as Item
|
||||
@ -35,7 +34,7 @@ class SerializeHistoryTests(unittest.TestCase):
|
||||
"""Tests for serialize()."""
|
||||
|
||||
def setUp(self):
|
||||
self.page = QWebPage()
|
||||
self.page = helpers.get_webpage()
|
||||
self.history = self.page.history()
|
||||
self.assertEqual(self.history.count(), 0)
|
||||
|
||||
@ -109,7 +108,7 @@ class SerializeHistorySpecialTests(unittest.TestCase):
|
||||
"""Tests for serialize() without items set up in setUp."""
|
||||
|
||||
def setUp(self):
|
||||
self.page = QWebPage()
|
||||
self.page = helpers.get_webpage()
|
||||
self.history = self.page.history()
|
||||
self.assertEqual(self.history.count(), 0)
|
||||
|
||||
|
@ -25,6 +25,8 @@ import contextlib
|
||||
from unittest import mock
|
||||
|
||||
from PyQt5.QtGui import QKeyEvent
|
||||
from PyQt5.QtWebKitWidgets import QWebPage
|
||||
from PyQt5.QtNetwork import QNetworkAccessManager
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
@ -75,6 +77,14 @@ def fake_keyevent(key, modifiers=0, text=''):
|
||||
return evtmock
|
||||
|
||||
|
||||
def get_webpage():
|
||||
"""Get a new QWebPage object."""
|
||||
page = QWebPage()
|
||||
nam = page.networkAccessManager()
|
||||
nam.setNetworkAccessible(QNetworkAccessManager.NotAccessible)
|
||||
return page
|
||||
|
||||
|
||||
class MessageModule:
|
||||
|
||||
"""A drop-in replacement for qutebrowser.utils.message."""
|
||||
|
Loading…
Reference in New Issue
Block a user