Added QSignalSpy to TestClient to ensure that reply signal is emitted and contains correct value.

This commit is contained in:
Nathan Osman 2013-07-03 10:55:41 -07:00
parent 6609f0bb02
commit 95d1ca09f6
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,8 @@
void TestClient::initTestCase()
{
qRegisterMetaType<QRedis::Request::ReplyType>("ReplyType");
client.connectToHost("localhost");
QVERIFY(client.waitForConnected());
}
@ -21,5 +23,9 @@ void TestClient::cleanupTestCase()
void TestClient::testPing()
{
QRedis::Request * request = client.sendCommand("PING");
QSignalSpy spy(request, SIGNAL(reply(ReplyType,QVariant)));
QVERIFY(request->waitForReply());
QCOMPARE(spy.count(), 1);
QCOMPARE(spy[0][1].toString(), QString("PONG"));
}