diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-08-28 13:41:22 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-08-28 13:41:22 (GMT) |
commit | 17c78efa9452fc0619cbd73e124b66bc1f89fa5e (patch) | |
tree | 97ded26e15292d0f1e4da5079f5bc686b087edd3 /Swiften/Disco/UnitTest | |
parent | 33af107d8d4ffdeada9ea964fe696af4a23c5b95 (diff) | |
download | swift-contrib-17c78efa9452fc0619cbd73e124b66bc1f89fa5e.zip swift-contrib-17c78efa9452fc0619cbd73e124b66bc1f89fa5e.tar.bz2 |
Check whether disco#info responses are null.
Resolves: #953
Release-Notes: Handle case where clients send null disco#info results.
Diffstat (limited to 'Swiften/Disco/UnitTest')
-rw-r--r-- | Swiften/Disco/UnitTest/CapsManagerTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Swiften/Disco/UnitTest/CapsManagerTest.cpp b/Swiften/Disco/UnitTest/CapsManagerTest.cpp index 3d69338..793fdba 100644 --- a/Swiften/Disco/UnitTest/CapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/CapsManagerTest.cpp @@ -32,6 +32,7 @@ class CapsManagerTest : public CppUnit::TestFixture { CPPUNIT_TEST(testReceiveSuccesfulDiscoStoresCaps); CPPUNIT_TEST(testReceiveIncorrectVerificationDiscoDoesNotStoreCaps); CPPUNIT_TEST(testReceiveFailingDiscoFallsBack); + CPPUNIT_TEST(testReceiveNoDiscoFallsBack); CPPUNIT_TEST(testReceiveFailingFallbackDiscoFallsBack); CPPUNIT_TEST(testReceiveSameHashFromFailingUserAfterReconnectRequestsDisco); CPPUNIT_TEST(testReconnectResetsFallback); @@ -183,6 +184,18 @@ class CapsManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL("http://node2.im#" + capsInfo1alt->getVersion(), discoInfo->getNode()); } + void testReceiveNoDiscoFallsBack() { + std::auto_ptr<CapsManager> testling = createManager(); + sendPresenceWithCaps(user1, capsInfo1); + sendPresenceWithCaps(user2, capsInfo1alt); + stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), boost::shared_ptr<DiscoInfo>())); + + CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<DiscoInfo>(1, user2, IQ::Get)); + boost::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>()); + CPPUNIT_ASSERT(discoInfo); + CPPUNIT_ASSERT_EQUAL("http://node2.im#" + capsInfo1alt->getVersion(), discoInfo->getNode()); + } + void testReceiveFailingFallbackDiscoFallsBack() { std::auto_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); |