diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-08 08:54:40 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-09 08:18:09 +0000 |
commit | 9dc1aa57dfbf9c684e5c75451dd028b88099c348 (patch) | |
tree | 3238c74a2f8470a64e9a5f60ada359b69edbba3f /sources/pyside2/tests/QtNetwork | |
parent | 4a519e4c5b40f7128c422691cdb0073387e2c9e3 (diff) |
Add more bindings for QtNetwork
Task-number: PYSIDE-487
Change-Id: Id9a06b83173b9a8880a256fb45e8d85fb1978d65
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2/tests/QtNetwork')
-rw-r--r-- | sources/pyside2/tests/QtNetwork/CMakeLists.txt | 1 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/dnslookup_test.py | 59 |
2 files changed, 60 insertions, 0 deletions
diff --git a/sources/pyside2/tests/QtNetwork/CMakeLists.txt b/sources/pyside2/tests/QtNetwork/CMakeLists.txt index f93de5c17..c14c19fa9 100644 --- a/sources/pyside2/tests/QtNetwork/CMakeLists.txt +++ b/sources/pyside2/tests/QtNetwork/CMakeLists.txt @@ -1,6 +1,7 @@ PYSIDE_TEST(bug_446.py) PYSIDE_TEST(bug_1084.py) PYSIDE_TEST(accessManager_test.py) +PYSIDE_TEST(dnslookup_test.py) # Qt5: QHttp is gone PYSIDE_TEST(http_test.py) PYSIDE_TEST(tcpserver_test.py) PYSIDE_TEST(udpsocket_test.py) diff --git a/sources/pyside2/tests/QtNetwork/dnslookup_test.py b/sources/pyside2/tests/QtNetwork/dnslookup_test.py new file mode 100644 index 000000000..b0375b0f5 --- /dev/null +++ b/sources/pyside2/tests/QtNetwork/dnslookup_test.py @@ -0,0 +1,59 @@ +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of Qt for Python. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +'''Test cases for QDnsLookup''' + +import unittest + +from PySide2.QtCore import QCoreApplication +from PySide2.QtNetwork import QDnsLookup + +class DnsLookupTestCase(unittest.TestCase): + '''Test case for QDnsLookup''' + + def setUp(self): + self._app = QCoreApplication([]) + self._lookup = QDnsLookup(QDnsLookup.ANY, 'www.qt.io') + self._lookup.finished.connect(self._finished) + + def tearDown(self): + del self._lookup + + def _finished(self): + if self._lookup.error() == QDnsLookup.NoError: + nameRecords = self._lookup.canonicalNameRecords() + if nameRecords: + print(nameRecords[0].name()) + self._app.quit() + + def testLookup(self): + self._lookup.lookup() + self._app.exec_() + +if __name__ == '__main__': + unittest.main() |