diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2015-07-27 10:34:55 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2015-07-27 10:34:55 +0200 |
| commit | 49112bd127ba9335b60f815481dd02dfbabb1cf7 (patch) | |
| tree | 853b7db4b3859c4c116917a49a90f4de158d0288 /tests | |
| parent | 7614137a3f3706d6b2fdf1bdacae9569c683b0b0 (diff) | |
| download | qxmpp-49112bd127ba9335b60f815481dd02dfbabb1cf7.tar.gz | |
improve tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/qxmppsocks/tst_qxmppsocks.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/qxmppsocks/tst_qxmppsocks.cpp b/tests/qxmppsocks/tst_qxmppsocks.cpp index 299417ae..747a4c6b 100644 --- a/tests/qxmppsocks/tst_qxmppsocks.cpp +++ b/tests/qxmppsocks/tst_qxmppsocks.cpp @@ -34,6 +34,7 @@ private slots: void newConnectionSlot(QTcpSocket *socket, QString hostName, quint16 port); void testClientAndServer(); + void testServer_data(); void testServer(); void testServerBadHandshake_data(); void testServerBadHandshake(); @@ -84,8 +85,18 @@ void tst_QXmppSocks::testClientAndServer() client.disconnectFromHost(); } +void tst_QXmppSocks::testServer_data() +{ + QTest::addColumn<QByteArray>("clientHandshake"); + + QTest::newRow("no authentication") << QByteArray::fromHex("050100"); + QTest::newRow("no authentication or GSSAPI") << QByteArray::fromHex("05020001"); +} + void tst_QXmppSocks::testServer() { + QFETCH(QByteArray, clientHandshake); + QXmppSocksServer server; QVERIFY(server.listen()); QVERIFY(server.serverPort() != 0); @@ -99,8 +110,8 @@ void tst_QXmppSocks::testServer() QEventLoop loop; connect(&client, SIGNAL(readyRead()), &loop, SLOT(quit())); - // SOCKS5, no authentication - client.write(QByteArray::fromHex("050100")); + // send client handshake + client.write(clientHandshake); loop.exec(); QCOMPARE(client.readAll(), QByteArray::fromHex("0500")); @@ -128,6 +139,7 @@ void tst_QXmppSocks::testServerBadHandshake_data() QTest::newRow("bad SOCKS version") << QByteArray::fromHex("060100"); QTest::newRow("no methods") << QByteArray::fromHex("0500"); + QTest::newRow("GSSAPI only") << QByteArray::fromHex("050101"); } void tst_QXmppSocks::testServerBadHandshake() @@ -147,6 +159,7 @@ void tst_QXmppSocks::testServerBadHandshake() QEventLoop loop; connect(&client, SIGNAL(disconnected()), &loop, SLOT(quit())); + // send client handshake client.write(clientHandshake); loop.exec(); |
