diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-09-28 16:45:00 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-09-28 16:45:00 (GMT) |
commit | 1daf22de85758cfd035f1fcf6a70007315db4f28 (patch) | |
tree | ae822e3db619af06ec1b26fd342165b24fe89543 /Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp | |
parent | 5c544f02222a3318b8581f68071b6a6b66b1d4c0 (diff) | |
download | swift-contrib-1daf22de85758cfd035f1fcf6a70007315db4f28.zip swift-contrib-1daf22de85758cfd035f1fcf6a70007315db4f28.tar.bz2 |
Destroy rooms.
Resolves: #990
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp index cc2463d..45862e2 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp @@ -9,6 +9,7 @@ #include <Swiften/Base/foreach.h> #include <Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h> +#include <Swiften/Elements/MUCDestroyPayload.h> #include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h> using namespace Swift; @@ -18,6 +19,7 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE(MUCUserPayloadParserTest); CPPUNIT_TEST(testParseEmpty); CPPUNIT_TEST(testParse); + CPPUNIT_TEST(testParseDestroy); CPPUNIT_TEST_SUITE_END(); public: @@ -56,6 +58,19 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT(payload->getItems().empty()); } + + void testParseDestroy() { + PayloadsParserTester parser; + + CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><destroy jid='alice@wonderland.lit'><reason>bert</reason></destroy></x>")); + + MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + CPPUNIT_ASSERT(payload); + MUCDestroyPayload::ref destroy = boost::dynamic_pointer_cast<MUCDestroyPayload>(payload->getPayload()); + CPPUNIT_ASSERT(destroy); + CPPUNIT_ASSERT_EQUAL(std::string("bert"), destroy->getReason()); + CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit"), destroy->getNewVenue()); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(MUCUserPayloadParserTest); |