Get rid of FakeUrl stub

We can just use a real QUrl...
This commit is contained in:
Florian Bruhin 2017-12-11 07:10:17 +01:00
parent 6c7b8ce895
commit 2a8b74cbec

View File

@ -24,7 +24,7 @@
from unittest import mock
import attr
from PyQt5.QtCore import pyqtSignal, QPoint, QProcess, QObject
from PyQt5.QtCore import pyqtSignal, QPoint, QProcess, QObject, QUrl
from PyQt5.QtNetwork import (QNetworkRequest, QAbstractNetworkCache,
QNetworkCacheMetaData)
from PyQt5.QtWidgets import QCommonStyle, QLineEdit, QWidget, QTabBar
@ -127,19 +127,6 @@ class FakeQApplication:
self.activeWindow = lambda: active_window
class FakeUrl:
"""QUrl stub which provides .path(), isValid() and host()."""
def __init__(self, path=None, valid=True, host=None, url=None,
scheme=None):
self.path = mock.Mock(return_value=path)
self.isValid = mock.Mock(returl_value=valid)
self.host = mock.Mock(returl_value=host)
self.toDisplayString = mock.Mock(return_value=url)
self.scheme = mock.Mock(return_value=scheme)
class FakeNetworkReply:
"""QNetworkReply stub which provides a Content-Disposition header."""
@ -150,7 +137,7 @@ class FakeNetworkReply:
def __init__(self, headers=None, url=None):
if url is None:
url = FakeUrl()
url = QUrl()
if headers is None:
self.headers = {}
else:
@ -246,7 +233,7 @@ class FakeWebTab(browsertab.AbstractTab):
"""Fake AbstractTab to use in tests."""
def __init__(self, url=FakeUrl(), title='', tab_id=0, *,
def __init__(self, url=QUrl(), title='', tab_id=0, *,
scroll_pos_perc=(0, 0),
load_status=usertypes.LoadStatus.success,
progress=0, can_go_back=None, can_go_forward=None):