blob: b0f40843c17b620f99991981e9f931dd63ed2c01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h"
#include "Swiften/Elements/PrivateStorage.h"
#include "Swiften/Elements/Storage.h"
using namespace Swift;
class PrivateStorageSerializerTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(PrivateStorageSerializerTest);
CPPUNIT_TEST(testSerialize);
CPPUNIT_TEST_SUITE_END();
public:
PrivateStorageSerializerTest() {}
void testSerialize() {
PayloadsSerializer serializer;
boost::shared_ptr<PrivateStorage> privateStorage(new PrivateStorage());
boost::shared_ptr<Storage> storage(new Storage());
Storage::Room room;
room.name = "Swift";
room.jid = JID("swift@rooms.swift.im");
room.nick = "Alice";
storage->addRoom(room);
privateStorage->setPayload(storage);
CPPUNIT_ASSERT_EQUAL(std::string(
"<query xmlns=\"jabber:iq:private\">"
"<storage xmlns=\"storage:bookmarks\">"
"<conference "
"autojoin=\"0\" "
"jid=\"swift@rooms.swift.im\" "
"name=\"Swift\">"
"<nick>Alice</nick>"
"</conference>"
"</storage>"
"</query>"), serializer.serialize(privateStorage));
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(PrivateStorageSerializerTest);
|