diff options
Diffstat (limited to 'tests/unit/utils/test_urlutils.py')
-rw-r--r-- | tests/unit/utils/test_urlutils.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/tests/unit/utils/test_urlutils.py b/tests/unit/utils/test_urlutils.py index d433783cf..d2eab5928 100644 --- a/tests/unit/utils/test_urlutils.py +++ b/tests/unit/utils/test_urlutils.py @@ -1,19 +1,6 @@ -# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org> # -# This file is part of qutebrowser. -# -# qutebrowser is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# qutebrowser is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later """Tests for qutebrowser.utils.urlutils.""" @@ -23,7 +10,7 @@ import dataclasses import urllib.parse from qutebrowser.qt.core import QUrl -from qutebrowser.qt.network import QNetworkProxy +from qutebrowser.qt.network import QNetworkProxy, QHostInfo import pytest import hypothesis import hypothesis.strategies @@ -51,7 +38,7 @@ class FakeDNS: @dataclasses.dataclass class FakeDNSAnswer: - error: bool + error: QHostInfo.HostInfoError def __init__(self): self.used = False @@ -66,7 +53,9 @@ class FakeDNS: self.answer = None def _get_error(self): - return not self.answer + if self.answer: + return QHostInfo.HostInfoError.NoError + return QHostInfo.HostInfoError.HostNotFound def fromname_mock(self, _host): """Simple mock for QHostInfo::fromName returning a FakeDNSAnswer.""" |