/soc/2013/ankitkv/gobjectification: a1a571f18552: Fixed jabber t...
Ankit Vani
a at nevitus.org
Sat Jun 15 16:45:08 EDT 2013
Changeset: a1a571f185526cc70589cfe872f9f2cde9bb8ce5
Author: Ankit Vani <a at nevitus.org>
Date: 2013-06-16 02:14 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/a1a571f18552
Description:
Fixed jabber tests to use the refactored jabber protocol
diffstat:
libpurple/tests/test_jabber_caps.c | 14 ++++++++++++--
libpurple/tests/test_jabber_scram.c | 3 ++-
2 files changed, 14 insertions(+), 3 deletions(-)
diffs (51 lines):
diff --git a/libpurple/tests/test_jabber_caps.c b/libpurple/tests/test_jabber_caps.c
--- a/libpurple/tests/test_jabber_caps.c
+++ b/libpurple/tests/test_jabber_caps.c
@@ -3,6 +3,8 @@
#include "tests.h"
#include "../xmlnode.h"
#include "../protocols/jabber/caps.h"
+#include "../ciphers/md5.h"
+#include "../ciphers/sha1.h"
START_TEST(test_parse_invalid)
{
@@ -25,14 +27,22 @@ END_TEST
#define assert_caps_calculate_match(hash_func, hash, str) { \
xmlnode *query = xmlnode_from_str((str), -1); \
+ PurpleCipher *hasher; \
JabberCapsClientInfo *info = jabber_caps_parse_client_info(query); \
- gchar *got_hash = jabber_caps_calculate_hash(info, (hash_func)); \
+ gchar *got_hash; \
+ if (g_str_equal(hash_func, "sha-1")) { \
+ hasher = purple_sha1_cipher_new(); \
+ } else if (g_str_equal(hash_func, "md5")) { \
+ hasher = purple_md5_cipher_new(); \
+ } \
+ got_hash = jabber_caps_calculate_hash(info, hasher); \
+ g_object_unref(hasher); \
assert_string_equal_free((hash), got_hash); \
}
START_TEST(test_calculate_caps)
{
- assert_caps_calculate_match("sha1", "GNjxthSckUNvAIoCCJFttjl6VL8=",
+ assert_caps_calculate_match("sha-1", "GNjxthSckUNvAIoCCJFttjl6VL8=",
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://tkabber.jabber.ru/#GNjxthSckUNvAIoCCJFttjl6VL8='><identity category='client' type='pc' name='Tkabber'/><x xmlns='jabber:x:data' type='result'><field var='FORM_TYPE' type='hidden'><value>urn:xmpp:dataforms:softwareinfo</value></field><field var='software'><value>Tkabber</value></field><field var='software_version'><value> ( 8.5.5 )</value></field><field var='os'><value>ATmega640-16AU</value></field><field var='os_version'><value/></field></x><feature var='games:board'/><feature var='google:mail:notify'/><feature var='http://jabber.org/protocol/activity'/><feature var='http://jabber.org/protocol/bytestreams'/><feature var='http://jabber.org/protocol/chatstates'/><feature var='http://jabber.org/protocol/commands'/><feature var='http://jabber.org/protocol/commands'/><feature var='http://jabber.org/protocol/disco#info'/><feature var='http://jabber.org/protocol/disco#items'/><feature var='http://jabber.org/protocol/feature-neg'/><feature var='http://jabber.org/protocol/geoloc'/><feature var='http://jabber.org/protocol/ibb'/><feature var='http://jabber.org/protocol/iqibb'/><feature var='http://jabber.org/protocol/mood'/><feature var='http://jabber.org/protocol/muc'/><feature var='http://jabber.org/protocol/mute#ancestor'/><feature var='http://jabber.org/protocol/mute#editor'/><feature var='http://jabber.org/protocol/rosterx'/><feature var='http://jabber.org/protocol/si'/><feature var='http://jabber.org/protocol/si/profile/file-transfer'/><feature var='http://jabber.org/protocol/tune'/><feature var='jabber:iq:avatar'/><feature var='jabber:iq:browse'/><feature var='jabber:iq:dtcp'/><feature var='jabber:iq:filexfer'/><feature var='jabber:iq:ibb'/><feature var='jabber:iq:inband'/><feature var='jabber:iq:jidlink'/><feature var='jabber:iq:last'/><feature var='jabber:iq:oob'/><feature var='jabber:iq:privacy'/><feature var='jabber:iq:time'/><feature var='jabber:iq:version'/><feature var='jabber:x:data'/><feature var='jabber:x:event'/><feature var='jabber:x:oob'/><feature var='urn:xmpp:ping'/><feature var='urn:xmpp:receipts'/><feature var='urn:xmpp:time'/></query>");
}
END_TEST
diff --git a/libpurple/tests/test_jabber_scram.c b/libpurple/tests/test_jabber_scram.c
--- a/libpurple/tests/test_jabber_scram.c
+++ b/libpurple/tests/test_jabber_scram.c
@@ -4,8 +4,9 @@
#include "../util.h"
#include "../protocols/jabber/auth_scram.h"
#include "../protocols/jabber/jutil.h"
+#include "../ciphers/sha1.h"
-static JabberScramHash sha1_mech = { "-SHA-1", "sha1", 20 };
+static JabberScramHash sha1_mech = { "-SHA-1", purple_sha1_cipher_new, 20 };
#define assert_pbkdf2_equal(password, salt, count, expected) { \
GString *p = g_string_new(password); \
More information about the Commits
mailing list