diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-05-06 18:50:32 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-05-06 18:52:52 (GMT) |
commit | a49e2a1d4d17c36fad6ac1d1313fac955f675a54 (patch) | |
tree | 5403d40ffcd2ec6d3a858db6f9e3320f64c6af87 /Swiften/Parser/PayloadParsers/UnitTest | |
parent | 0cec4698efdb9fa0072e5d8cbccd6cb806b940e9 (diff) | |
download | swift-a49e2a1d4d17c36fad6ac1d1313fac955f675a54.zip swift-a49e2a1d4d17c36fad6ac1d1313fac955f675a54.tar.bz2 |
Completed storage bookmark parser & serializer.
Added URI element.
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp index 88dd125..03dc144 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp @@ -16,6 +16,7 @@ class StorageParserTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StorageParserTest); CPPUNIT_TEST(testParse_Conference); CPPUNIT_TEST(testParse_MultipleConferences); + CPPUNIT_TEST(testParse_URL); CPPUNIT_TEST_SUITE_END(); public: @@ -65,6 +66,22 @@ class StorageParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(String("Tea party"), conferences[1].name); CPPUNIT_ASSERT_EQUAL(JID("teaparty@wonderland.lit"), conferences[1].jid); } + + void testParse_URL() { + PayloadsParserTester parser; + + CPPUNIT_ASSERT(parser.parse( + "<storage xmlns='storage:bookmarks'>" + "<url name='Complete Works of Shakespeare' url='http://the-tech.mit.edu/Shakespeare/'/>" + "</storage>")); + + Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get()); + std::vector<Storage::URL> urls = payload->getURLs(); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(urls.size())); + CPPUNIT_ASSERT_EQUAL(String("Complete Works of Shakespeare"), urls[0].name); + CPPUNIT_ASSERT_EQUAL(String("http://the-tech.mit.edu/Shakespeare/"), urls[0].url); + } + }; CPPUNIT_TEST_SUITE_REGISTRATION(StorageParserTest); |