blob: 6a812987ff088be78f42992b3360de584331c33e (
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
|
/*
* 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/DiscoInfoSerializer.h"
using namespace Swift;
class DiscoInfoSerializerTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(DiscoInfoSerializerTest);
CPPUNIT_TEST(testSerialize);
CPPUNIT_TEST_SUITE_END();
public:
DiscoInfoSerializerTest() {}
void testSerialize() {
DiscoInfoSerializer testling;
boost::shared_ptr<DiscoInfo> discoInfo(new DiscoInfo());
discoInfo->addIdentity(DiscoInfo::Identity("Swift", "client", "pc"));
discoInfo->addIdentity(DiscoInfo::Identity("Vlug", "client", "pc", "nl"));
discoInfo->addFeature("http://jabber.org/protocol/caps");
discoInfo->addFeature("http://jabber.org/protocol/disco#info");
discoInfo->setNode("http://swift.im#bla");
String expectedResult =
"<query node=\"http://swift.im#bla\" xmlns=\"http://jabber.org/protocol/disco#info\">"
"<identity category=\"client\" name=\"Swift\" type=\"pc\"/>"
"<identity category=\"client\" name=\"Vlug\" type=\"pc\" xml:lang=\"nl\"/>"
"<feature var=\"http://jabber.org/protocol/caps\"/>"
"<feature var=\"http://jabber.org/protocol/disco#info\"/>"
"</query>";
CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(discoInfo));
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(DiscoInfoSerializerTest);
|