summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/UnitTest')
-rw-r--r--Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp16
-rw-r--r--Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp16
-rw-r--r--Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp16
-rw-r--r--Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp16
-rw-r--r--Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp10
-rw-r--r--Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp14
6 files changed, 50 insertions, 38 deletions
diff --git a/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp
index af857ef..2dcadcd 100644
--- a/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp
@@ -7,8 +7,10 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/AuthChallengeSerializer.h"
-#include "Swiften/Elements/AuthChallenge.h"
+#include <Swiften/Serializer/AuthChallengeSerializer.h>
+#include <Swiften/Elements/AuthChallenge.h>
+#include <Swiften/Base/ByteArray.h>
+#include <QA/Checker/IO.h>
using namespace Swift;
@@ -23,9 +25,9 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture {
void testSerialize() {
AuthChallengeSerializer testling;
boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge());
- authChallenge->setValue("foo");
+ authChallenge->setValue(createByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"Zm9v"
"</challenge>"), testling.serialize(authChallenge));
@@ -35,7 +37,7 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture {
AuthChallengeSerializer testling;
boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"</challenge>"), testling.serialize(authChallenge));
}
@@ -43,9 +45,9 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture {
void testSerialize_EmptyMessage() {
AuthChallengeSerializer testling;
boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge());
- authChallenge->setValue(ByteArray());
+ authChallenge->setValue(std::vector<unsigned char>());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"="
"</challenge>"), testling.serialize(authChallenge));
diff --git a/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp
index 9f9f2fa..7d7b1be 100644
--- a/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp
@@ -7,8 +7,10 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/AuthRequestSerializer.h"
-#include "Swiften/Elements/AuthRequest.h"
+#include <Swiften/Serializer/AuthRequestSerializer.h>
+#include <Swiften/Elements/AuthRequest.h>
+#include <Swiften/Base/ByteArray.h>
+#include <QA/Checker/IO.h>
using namespace Swift;
@@ -23,9 +25,9 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture {
void testSerialize() {
AuthRequestSerializer testling;
boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN"));
- authRequest->setMessage("foo");
+ authRequest->setMessage(createSafeByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">"
"Zm9v"
"</auth>"), testling.serialize(authRequest));
@@ -35,7 +37,7 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture {
AuthRequestSerializer testling;
boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">"
"</auth>"), testling.serialize(authRequest));
}
@@ -43,9 +45,9 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture {
void testSerialize_EmptyMessage() {
AuthRequestSerializer testling;
boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN"));
- authRequest->setMessage(ByteArray());
+ authRequest->setMessage(SafeByteArray());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">"
"="
"</auth>"), testling.serialize(authRequest));
diff --git a/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp
index c93810c..3be1185 100644
--- a/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp
@@ -7,8 +7,10 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/AuthResponseSerializer.h"
-#include "Swiften/Elements/AuthResponse.h"
+#include <Swiften/Serializer/AuthResponseSerializer.h>
+#include <Swiften/Elements/AuthResponse.h>
+#include <Swiften/Base/ByteArray.h>
+#include <QA/Checker/IO.h>
using namespace Swift;
@@ -23,9 +25,9 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture {
void testSerialize() {
AuthResponseSerializer testling;
boost::shared_ptr<AuthResponse> authResponse(new AuthResponse());
- authResponse->setValue("foo");
+ authResponse->setValue(createSafeByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"Zm9v"
"</response>"), testling.serialize(authResponse));
@@ -35,7 +37,7 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture {
AuthResponseSerializer testling;
boost::shared_ptr<AuthResponse> authResponse(new AuthResponse());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"</response>"), testling.serialize(authResponse));
}
@@ -43,9 +45,9 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture {
void testSerialize_EmptyMessage() {
AuthResponseSerializer testling;
boost::shared_ptr<AuthResponse> authResponse(new AuthResponse());
- authResponse->setValue(ByteArray());
+ authResponse->setValue(SafeByteArray());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"="
"</response>"), testling.serialize(authResponse));
diff --git a/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp
index 385c1e5..b8646c0 100644
--- a/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp
@@ -7,8 +7,10 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/AuthSuccessSerializer.h"
-#include "Swiften/Elements/AuthSuccess.h"
+#include <Swiften/Serializer/AuthSuccessSerializer.h>
+#include <Swiften/Elements/AuthSuccess.h>
+#include <Swiften/Base/ByteArray.h>
+#include <QA/Checker/IO.h>
using namespace Swift;
@@ -23,9 +25,9 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture {
void testSerialize() {
AuthSuccessSerializer testling;
boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess());
- authSuccess->setValue("foo");
+ authSuccess->setValue(createByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"Zm9v"
"</success>"), testling.serialize(authSuccess));
@@ -35,7 +37,7 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture {
AuthSuccessSerializer testling;
boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"</success>"), testling.serialize(authSuccess));
}
@@ -43,9 +45,9 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture {
void testSerialize_EmptyMessage() {
AuthSuccessSerializer testling;
boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess());
- authSuccess->setValue(ByteArray());
+ authSuccess->setValue(std::vector<unsigned char>());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"="
"</success>"), testling.serialize(authSuccess));
diff --git a/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp b/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp
index 65caa81..b30a774 100644
--- a/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp
@@ -7,8 +7,10 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/StreamFeaturesSerializer.h"
-#include "Swiften/Elements/StreamFeatures.h"
+#include <Swiften/Serializer/StreamFeaturesSerializer.h>
+#include <Swiften/Elements/StreamFeatures.h>
+#include <QA/Checker/IO.h>
+
using namespace Swift;
@@ -32,8 +34,9 @@ class StreamFeaturesSerializerTest : public CppUnit::TestFixture
streamFeatures->setHasResourceBind();
streamFeatures->setHasSession();
streamFeatures->setHasStreamManagement();
+ streamFeatures->setHasRosterVersioning();
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<stream:features>"
"<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>"
"<compression xmlns=\"http://jabber.org/features/compress\">"
@@ -47,6 +50,7 @@ class StreamFeaturesSerializerTest : public CppUnit::TestFixture
"<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>"
"<session xmlns=\"urn:ietf:params:xml:ns:xmpp-session\"/>"
"<sm xmlns=\"urn:xmpp:sm:2\"/>"
+ "<ver xmlns=\"urn:xmpp:features:rosterver\"/>"
"</stream:features>"), testling.serialize(streamFeatures));
}
};
diff --git a/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp b/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp
index 76c1b23..c0ab841 100644
--- a/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp
@@ -7,10 +7,10 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/XMPPSerializer.h"
-#include "Swiften/Elements/AuthChallenge.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/Elements/ProtocolHeader.h"
+#include <Swiften/Serializer/XMPPSerializer.h>
+#include <Swiften/Elements/AuthChallenge.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/Elements/ProtocolHeader.h>
using namespace Swift;
@@ -31,7 +31,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture {
}
void testSerializeHeader_Client() {
- std::auto_ptr<XMPPSerializer> testling(createSerializer(ClientStreamType));
+ boost::shared_ptr<XMPPSerializer> testling(createSerializer(ClientStreamType));
ProtocolHeader protocolHeader;
protocolHeader.setFrom("bla@foo.com");
protocolHeader.setTo("foo.com");
@@ -42,7 +42,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture {
}
void testSerializeHeader_Component() {
- std::auto_ptr<XMPPSerializer> testling(createSerializer(ComponentStreamType));
+ boost::shared_ptr<XMPPSerializer> testling(createSerializer(ComponentStreamType));
ProtocolHeader protocolHeader;
protocolHeader.setFrom("bla@foo.com");
protocolHeader.setTo("foo.com");
@@ -53,7 +53,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture {
}
void testSerializeHeader_Server() {
- std::auto_ptr<XMPPSerializer> testling(createSerializer(ServerStreamType));
+ boost::shared_ptr<XMPPSerializer> testling(createSerializer(ServerStreamType));
ProtocolHeader protocolHeader;
protocolHeader.setFrom("bla@foo.com");
protocolHeader.setTo("foo.com");