summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-09-12 22:10:43 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-09-14 10:42:18 (GMT)
commit7585bf84c6d6405cfb97ae2509d43eb77cac94de (patch)
tree65a39e2ec6cd9dad57fd12d2cc0de542e9fc03a5 /Swiften/Serializer/PayloadSerializers/UnitTest
parentba4292f83f92037fdd12b0f7413f628a4b2c7a22 (diff)
downloadswift-contrib-7585bf84c6d6405cfb97ae2509d43eb77cac94de.zip
swift-contrib-7585bf84c6d6405cfb97ae2509d43eb77cac94de.tar.bz2
Added storage serializer.
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/UnitTest')
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp
new file mode 100644
index 0000000..158e7f1
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp
@@ -0,0 +1,59 @@
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include "Swiften/Serializer/PayloadSerializers/StorageSerializer.h"
+
+using namespace Swift;
+
+class StorageSerializerTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(StorageSerializerTest);
+ CPPUNIT_TEST(testSerialize);
+ CPPUNIT_TEST(testSerialize_NoNickOrPassword);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ StorageSerializerTest() {}
+
+ void testSerialize() {
+ StorageSerializer testling;
+ boost::shared_ptr<Storage> storage(new Storage());
+ Storage::Conference conference;
+ conference.name = "Council of Oberon";
+ conference.autoJoin = true;
+ conference.jid = JID("council@conference.underhill.org");
+ conference.nick = "Puck";
+ conference.password = "MyPass";
+ storage->addConference(conference);
+
+ CPPUNIT_ASSERT_EQUAL(String(
+ "<storage xmlns=\"storage:bookmarks\">"
+ "<conference "
+ "autojoin=\"1\" "
+ "jid=\"council@conference.underhill.org\" "
+ "name=\"Council of Oberon\">"
+ "<nick>Puck</nick>"
+ "<password>MyPass</password>"
+ "</conference>"
+ "</storage>"), testling.serialize(storage));
+ }
+
+ void testSerialize_NoNickOrPassword() {
+ StorageSerializer testling;
+ boost::shared_ptr<Storage> storage(new Storage());
+ Storage::Conference conference;
+ conference.name = "Council of Oberon";
+ conference.autoJoin = true;
+ conference.jid = JID("council@conference.underhill.org");
+ storage->addConference(conference);
+
+ CPPUNIT_ASSERT_EQUAL(String(
+ "<storage xmlns=\"storage:bookmarks\">"
+ "<conference "
+ "autojoin=\"1\" "
+ "jid=\"council@conference.underhill.org\" "
+ "name=\"Council of Oberon\"/>"
+ "</storage>"), testling.serialize(storage));
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(StorageSerializerTest);