diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-05-08 08:01:56 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-05-08 08:24:22 (GMT) |
commit | 5616ff49792238b451486f41b187744866d20056 (patch) | |
tree | 6c3a2f56d7aac99db4dbd7317768dfe1949a96e8 /Swiften/SASL/UnitTest | |
parent | 203ca1c122db89c4a9f9f01bff2cadb3b9daca04 (diff) | |
download | swift-5616ff49792238b451486f41b187744866d20056.zip swift-5616ff49792238b451486f41b187744866d20056.tar.bz2 |
Added DIGEST-MD5 properties.
Diffstat (limited to 'Swiften/SASL/UnitTest')
-rw-r--r-- | Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp b/Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp new file mode 100644 index 0000000..0c1543a --- /dev/null +++ b/Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp @@ -0,0 +1,46 @@ +/* + * 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/SASL/DIGESTMD5Properties.h" + +using namespace Swift; + +class DIGESTMD5PropertiesTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(DIGESTMD5PropertiesTest); + CPPUNIT_TEST(testParse); + CPPUNIT_TEST(testSerialize); + CPPUNIT_TEST_SUITE_END(); + + public: + void testParse() { + DIGESTMD5Properties properties = DIGESTMD5Properties::parse(ByteArray( + "realm=\"myrealm1\",realm=\"myrealm2\",nonce=\"mynonce\"," + "algorithm=\"md5-sess\"")); + } + + void testSerialize() { + DIGESTMD5Properties properties; + properties.setValue("authzid", "myauthzid"); + properties.setValue("charset", "utf-8"); + properties.setValue("cnonce", "mycnonce"); + properties.setValue("digest-uri", "mydigesturi"); + properties.setValue("nc", "1"); + properties.setValue("nonce", "mynonce"); + properties.setValue("qop", "auth"); + properties.setValue("realm", "myrealm"); + properties.setValue("response", "myresponse"); + properties.setValue("username", "myuser"); + + ByteArray result = properties.serialize(); + ByteArray expected("authzid=\"myauthzid\",charset=utf-8,cnonce=\"mycnonce\",digest-uri=\"mydigesturi\",nc=1,nonce=\"mynonce\",qop=auth,realm=\"myrealm\",response=myresponse,username=\"myuser\""); + CPPUNIT_ASSERT_EQUAL(expected.toString(), result.toString()); + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(DIGESTMD5PropertiesTest); |