blob: a8acf80752349cac4144e0c2bdb7fedcb9b0f7ea (
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
|
/*
* Copyright (c) 2011 Kevin Smith
* 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 <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h>
using namespace Swift;
class MUCAdminPayloadSerializerTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(MUCAdminPayloadSerializerTest);
CPPUNIT_TEST(testSerialize);
CPPUNIT_TEST_SUITE_END();
public:
MUCAdminPayloadSerializerTest() {}
void testSerialize() {
MUCAdminPayloadSerializer testling;
boost::shared_ptr<MUCAdminPayload> admin = boost::make_shared<MUCAdminPayload>();
MUCItem item;
item.affiliation = MUCOccupant::Owner;
item.role = MUCOccupant::Visitor;
item.reason = "malice";
item.actor = JID("kev@tester.lit");
admin->addItem(item);
CPPUNIT_ASSERT_EQUAL(std::string("<query xmlns=\"http://jabber.org/protocol/muc#admin\"><item affiliation=\"owner\" role=\"visitor\"><actor jid=\"kev@tester.lit\"/><reason>malice</reason></item></query>"), testling.serialize(admin));
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(MUCAdminPayloadSerializerTest);
|