diff options
Diffstat (limited to 'sources/pyside2/tests/QtNetwork')
-rw-r--r-- | sources/pyside2/tests/QtNetwork/CMakeLists.txt | 9 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/accessManager_test.py | 77 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/bug_1084.py | 51 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/bug_446.py | 83 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/dnslookup_test.py | 65 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/qipv6address_test.py | 56 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/qpassworddigestor_test.py | 51 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/tcpserver_test.py | 58 | ||||
-rw-r--r-- | sources/pyside2/tests/QtNetwork/udpsocket_test.py | 85 |
9 files changed, 0 insertions, 535 deletions
diff --git a/sources/pyside2/tests/QtNetwork/CMakeLists.txt b/sources/pyside2/tests/QtNetwork/CMakeLists.txt deleted file mode 100644 index 754f8e5af..000000000 --- a/sources/pyside2/tests/QtNetwork/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -PYSIDE_TEST(bug_446.py) -PYSIDE_TEST(bug_1084.py) -PYSIDE_TEST(accessManager_test.py) -PYSIDE_TEST(dnslookup_test.py) -# Qt${QT_MAJOR_VERSION}: QHttp is gone PYSIDE_TEST(http_test.py) -PYSIDE_TEST(qpassworddigestor_test.py) -PYSIDE_TEST(tcpserver_test.py) -PYSIDE_TEST(udpsocket_test.py) -PYSIDE_TEST(qipv6address_test.py) diff --git a/sources/pyside2/tests/QtNetwork/accessManager_test.py b/sources/pyside2/tests/QtNetwork/accessManager_test.py deleted file mode 100644 index 12ed25317..000000000 --- a/sources/pyside2/tests/QtNetwork/accessManager_test.py +++ /dev/null @@ -1,77 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 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 QHttp''' - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import * -from PySide2.QtNetwork import * - -from helper.usesqcoreapplication import UsesQCoreApplication -from httpd import TestServer - -class AccessManagerCase(UsesQCoreApplication): - - def setUp(self): - super(AccessManagerCase, self).setUp() - self.httpd = TestServer() - self.httpd.start() - self.called = False - - def tearDown(self): - super(AccessManagerCase, self).tearDown() - if self.httpd: - self.httpd.shutdown() - self.httpd = None - - def goAway(self): - self.httpd.shutdown() - self.app.quit() - self.httpd = None - - def slot_replyFinished(self, reply): - self.assertEqual(type(reply), QNetworkReply) - self.called = True - self.goAway() - - def testNetworkRequest(self): - manager = QNetworkAccessManager() - manager.finished.connect(self.slot_replyFinished) - manager.get(QNetworkRequest(QUrl("http://127.0.0.1:%s" % self.httpd.port()))) - self.app.exec_() - self.assertTrue(self.called) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtNetwork/bug_1084.py b/sources/pyside2/tests/QtNetwork/bug_1084.py deleted file mode 100644 index cd8dd7621..000000000 --- a/sources/pyside2/tests/QtNetwork/bug_1084.py +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 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$ -## -############################################################################# - -''' unit test for BUG #1084 ''' - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2 import QtNetwork - - -class QTcpSocketTestCase(unittest.TestCase): - def setUp(self): - self.sock = QtNetwork.QTcpSocket() - self.sock.connectToHost('127.0.0.1', 25) - - def testIt(self): - self.sock.write(bytes('quit', "UTF-8")) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtNetwork/bug_446.py b/sources/pyside2/tests/QtNetwork/bug_446.py deleted file mode 100644 index 7e7242515..000000000 --- a/sources/pyside2/tests/QtNetwork/bug_446.py +++ /dev/null @@ -1,83 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 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$ -## -############################################################################# - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import * -from PySide2.QtNetwork import * - -from helper.usesqcoreapplication import UsesQCoreApplication - - -class HttpSignalsCase(UsesQCoreApplication): - '''Test case for launching QHttp signals''' - DATA = bytes("PySide rocks", "UTF-8") - - def onError(self): - self.assertTrue(False) - - def onNewConnection(self): - self.serverConnection = self.server.nextPendingConnection() - self.serverConnection.errorOccurred.connect(self.onError) - self.serverConnection.write(HttpSignalsCase.DATA) - self.server.close() - - def onReadReady(self): - data = self.client.read(100) - self.assertEqual(len(data), len(HttpSignalsCase.DATA)) - self.assertEqual(data, HttpSignalsCase.DATA) - self.done() - - def onClientConnect(self): - self.client.readyRead.connect(self.onReadReady) - - def initServer(self): - self.server = QTcpServer() - self.server.newConnection.connect(self.onNewConnection) - self.assertTrue(self.server.listen()) - self.client = QTcpSocket() - self.client.connected.connect(self.onClientConnect) - self.client.connectToHost(QHostAddress(QHostAddress.LocalHost), self.server.serverPort()) - - def done(self): - self.serverConnection.close() - self.client.close() - self.app.quit() - - def testRun(self): - self.initServer() - self.app.exec_() - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtNetwork/dnslookup_test.py b/sources/pyside2/tests/QtNetwork/dnslookup_test.py deleted file mode 100644 index 3a8b7a2d7..000000000 --- a/sources/pyside2/tests/QtNetwork/dnslookup_test.py +++ /dev/null @@ -1,65 +0,0 @@ -############################################################################# -## -## 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 os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -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() diff --git a/sources/pyside2/tests/QtNetwork/qipv6address_test.py b/sources/pyside2/tests/QtNetwork/qipv6address_test.py deleted file mode 100644 index 046d4d850..000000000 --- a/sources/pyside2/tests/QtNetwork/qipv6address_test.py +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 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 QIPv6Address''' - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtNetwork import * - -class QIPv6AddressGetItemTest(unittest.TestCase): - def testLength(self): - ip = QIPv6Address() - self.assertEqual(len(ip), 16) - - def testSetItemNegativeIndex(self): - ip = QIPv6Address() - ip[-1] = 8 - self.assertEqual(ip[-1], 8) - - def testSetItemLargeIndex(self): - ip = QIPv6Address() - self.assertRaises(IndexError, ip.__setitem__, 32, 16) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtNetwork/qpassworddigestor_test.py b/sources/pyside2/tests/QtNetwork/qpassworddigestor_test.py deleted file mode 100644 index 13da3e733..000000000 --- a/sources/pyside2/tests/QtNetwork/qpassworddigestor_test.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## 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 QPasswordDigestor''' - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import QByteArray, QCryptographicHash -from PySide2.QtNetwork import QPasswordDigestor - -class TestPasswordDigestor(unittest.TestCase): - def test(self): - b = QPasswordDigestor.deriveKeyPbkdf1(QCryptographicHash.Sha1, - b'test', b'saltnpep', 10, 20) - self.assertEqual(b.size(), 20) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtNetwork/tcpserver_test.py b/sources/pyside2/tests/QtNetwork/tcpserver_test.py deleted file mode 100644 index 9a047e5c6..000000000 --- a/sources/pyside2/tests/QtNetwork/tcpserver_test.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 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 QTCPServer''' - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtNetwork import QTcpServer - -class ListenDefaultArgsCase(unittest.TestCase): - '''Test case for TcpServer.listen with default args''' - - def setUp(self): - #Acquire resources - self.server = QTcpServer() - - def tearDown(self): - #Release resources - del self.server - - def testDefaultArgs(self): - # @bug 108 - #Default arguments for QTcpServer.listen - self.server.listen() - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtNetwork/udpsocket_test.py b/sources/pyside2/tests/QtNetwork/udpsocket_test.py deleted file mode 100644 index 7ef567294..000000000 --- a/sources/pyside2/tests/QtNetwork/udpsocket_test.py +++ /dev/null @@ -1,85 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 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 QUdpSocket''' - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import QUrl, QObject, SIGNAL, QCoreApplication, QTimer -from PySide2.QtNetwork import QUdpSocket, QHostAddress - - -class HttpSignalsCase(unittest.TestCase): - '''Test case for bug #124 - readDatagram signature - - QUdpSocket.readDatagram must return a tuple with the datagram, host and - port, while receiving only the max payload size.''' - - def setUp(self): - #Acquire resources - self.called = False - self.app = QCoreApplication([]) - - self.socket = QUdpSocket() - - self.server = QUdpSocket() - self.server.bind(QHostAddress(QHostAddress.LocalHost), 45454) - - def tearDown(self): - #Release resources - del self.socket - del self.server - del self.app - - def sendPackage(self): - addr = QHostAddress(QHostAddress.LocalHost) - self.socket.writeDatagram(bytes('datagram', "UTF-8"), addr, 45454) - - def callback(self): - while self.server.hasPendingDatagrams(): - datagram, host, port = self.server.readDatagram(self.server.pendingDatagramSize()) - self.called = True - self.app.quit() - - def testDefaultArgs(self): - #QUdpSocket.readDatagram pythonic return - # @bug 124 - QObject.connect(self.server, SIGNAL('readyRead()'), self.callback) - self.sendPackage() - self.app.exec_() - - self.assertTrue(self.called) - -if __name__ == '__main__': - unittest.main() |