Added QSignalSpy to TestClient to ensure that reply signal is emitted and contains correct value.
This commit is contained in:
parent
6609f0bb02
commit
95d1ca09f6
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
void TestClient::initTestCase()
|
void TestClient::initTestCase()
|
||||||
{
|
{
|
||||||
|
qRegisterMetaType<QRedis::Request::ReplyType>("ReplyType");
|
||||||
|
|
||||||
client.connectToHost("localhost");
|
client.connectToHost("localhost");
|
||||||
QVERIFY(client.waitForConnected());
|
QVERIFY(client.waitForConnected());
|
||||||
}
|
}
|
||||||
|
|
@ -21,5 +23,9 @@ void TestClient::cleanupTestCase()
|
||||||
void TestClient::testPing()
|
void TestClient::testPing()
|
||||||
{
|
{
|
||||||
QRedis::Request * request = client.sendCommand("PING");
|
QRedis::Request * request = client.sendCommand("PING");
|
||||||
|
QSignalSpy spy(request, SIGNAL(reply(ReplyType,QVariant)));
|
||||||
|
|
||||||
QVERIFY(request->waitForReply());
|
QVERIFY(request->waitForReply());
|
||||||
|
QCOMPARE(spy.count(), 1);
|
||||||
|
QCOMPARE(spy[0][1].toString(), QString("PONG"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue