diff --git a/src/tests/settingsadhoccommand.cpp b/src/tests/settingsadhoccommand.cpp index e3e14d9cd61fb9ce964beb456a40ce0cce7ed1ae..3e9602be2e2b266e854d3ad70e9a81d8ceb9eb9a 100644 --- a/src/tests/settingsadhoccommand.cpp +++ b/src/tests/settingsadhoccommand.cpp @@ -26,6 +26,7 @@ using namespace Transport; class SettingsAdHocCommandTest : public CPPUNIT_NS :: TestFixture, public BasicTest { CPPUNIT_TEST_SUITE(SettingsAdHocCommandTest); CPPUNIT_TEST(getItems); + CPPUNIT_TEST(getInfo); CPPUNIT_TEST(execute); CPPUNIT_TEST(executeBadSessionID); CPPUNIT_TEST(executeNotRegistered); @@ -70,6 +71,22 @@ class SettingsAdHocCommandTest : public CPPUNIT_NS :: TestFixture, public BasicT CPPUNIT_ASSERT_EQUAL(std::string("settings"), getStanza(received[0])->getPayload()->getItems()[0].getNode()); } + void getInfo() { + boost::shared_ptr payload(new Swift::DiscoInfo()); + payload->setNode("settings"); + boost::shared_ptr iq = Swift::IQ::createRequest(Swift::IQ::Get, Swift::JID("localhost"), "id", payload); + iq->setFrom("user@localhost"); + injectIQ(iq); + loop->processEvents(); + + CPPUNIT_ASSERT_EQUAL(1, (int) received.size()); + CPPUNIT_ASSERT(dynamic_cast(getStanza(received[0]))); + CPPUNIT_ASSERT_EQUAL(Swift::IQ::Result, dynamic_cast(getStanza(received[0]))->getType()); + CPPUNIT_ASSERT(getStanza(received[0])->getPayload()); + CPPUNIT_ASSERT_EQUAL(std::string("automation"), getStanza(received[0])->getPayload()->getIdentities()[0].getCategory()); + CPPUNIT_ASSERT_EQUAL(std::string("command-node"), getStanza(received[0])->getPayload()->getIdentities()[0].getType()); + } + void executeNotRegistered() { boost::shared_ptr payload(new Swift::Command("settings")); boost::shared_ptr iq = Swift::IQ::createRequest(Swift::IQ::Set, Swift::JID("localhost"), "id", payload);