add test for invalid passive exchange declarations

Verify the behavior of signaling an error if a passive exchange is
declared, but not found on the server.
This commit is contained in:
Matt Broadstone 2015-02-04 16:40:22 -05:00
parent cac9d94491
commit 8cc8d5e641
1 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,7 @@ private Q_SLOTS:
void invalidImmediateRouting(); void invalidImmediateRouting();
void confirmsSupport(); void confirmsSupport();
void confirmDontLoseMessages(); void confirmDontLoseMessages();
void passiveDeclareNotFound();
private: private:
QScopedPointer<QAmqpClient> client; QScopedPointer<QAmqpClient> client;
@ -190,5 +191,13 @@ void tst_QAMQPExchange::confirmDontLoseMessages()
QVERIFY(defaultExchange->waitForConfirms()); QVERIFY(defaultExchange->waitForConfirms());
} }
void tst_QAMQPExchange::passiveDeclareNotFound()
{
QAmqpExchange *nonExistentExchange = client->createExchange("this-does-not-exist");
nonExistentExchange->declare(QAmqpExchange::Direct, QAmqpExchange::Passive);
QVERIFY(waitForSignal(nonExistentExchange, SIGNAL(error(QAMQP::Error))));
QCOMPARE(nonExistentExchange->error(), QAMQP::NotFoundError);
}
QTEST_MAIN(tst_QAMQPExchange) QTEST_MAIN(tst_QAMQPExchange)
#include "tst_qamqpexchange.moc" #include "tst_qamqpexchange.moc"