[gnome-keyring/gck-work: 16/18] [gck] Fix up tests problems after recent commits.



commit 2b3d17f0e086dce443715d2ed219c18868a84e67
Author: Stef Walter <stef memberwebs com>
Date:   Mon Aug 9 14:10:43 2010 +0200

    [gck] Fix up tests problems after recent commits.

 gck/tests/test-gck-crypto.c  |   12 ++++++------
 gck/tests/test-gck-object.c  |    5 +++--
 gck/tests/test-gck-session.c |    4 ++--
 3 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/gck/tests/test-gck-crypto.c b/gck/tests/test-gck-crypto.c
index 315f629..95e5515 100644
--- a/gck/tests/test-gck-crypto.c
+++ b/gck/tests/test-gck-crypto.c
@@ -270,34 +270,34 @@ DEFINE_TEST(sign)
 	mech = gck_mechanism_new_with_param (CKM_PREFIX, "my-prefix:", 10);
 
 	/* Enable auto-login on this session, see previous test */
-	g_signal_connect (module, "authenticate-object", G_CALLBACK (authenticate_object), NULL);
+	g_signal_connect (module_with_auth, "authenticate-object", G_CALLBACK (authenticate_object), NULL);
 
 	/* Find the right key */
-	key = find_key (session, CKA_SIGN, CKM_PREFIX);
+	key = find_key (session_with_auth, CKA_SIGN, CKM_PREFIX);
 	g_assert (key);
 
 	/* Simple one */
-	output = gck_session_sign (session, key, CKM_PREFIX, (const guchar*)"Labarbara", 10, &n_output, &error);
+	output = gck_session_sign (session_with_auth, key, CKM_PREFIX, (const guchar*)"Labarbara", 10, &n_output, &error);
 	SUCCESS_RES (output, error);
 	g_assert_cmpuint (n_output, ==, 24);
 	g_assert_cmpstr ((gchar*)output, ==, "signed-prefix:Labarbara");
 	g_free (output);
 
 	/* Full one */
-	output = gck_session_sign_full (session, key, mech, (const guchar*)"Labarbara", 10, &n_output, NULL, &error);
+	output = gck_session_sign_full (session_with_auth, key, mech, (const guchar*)"Labarbara", 10, &n_output, NULL, &error);
 	SUCCESS_RES (output, error);
 	g_assert_cmpuint (n_output, ==, 20);
 	g_assert_cmpstr ((gchar*)output, ==, "my-prefix:Labarbara");
 	g_free (output);
 
 	/* Asynchronous one */
-	gck_session_sign_async (session, key, mech, (const guchar*)"Conrad", 7, NULL, fetch_async_result, &result);
+	gck_session_sign_async (session_with_auth, key, mech, (const guchar*)"Conrad", 7, NULL, fetch_async_result, &result);
 
 	testing_wait_until (500);
 	g_assert (result != NULL);
 
 	/* Get the result */
-	output = gck_session_sign_finish (session, result, &n_output, &error);
+	output = gck_session_sign_finish (session_with_auth, result, &n_output, &error);
 	SUCCESS_RES (output, error);
 	g_assert_cmpuint (n_output, ==, 17);
 	g_assert_cmpstr ((gchar*)output, ==, "my-prefix:Conrad");
diff --git a/gck/tests/test-gck-object.c b/gck/tests/test-gck-object.c
index 10f4ef0..d88300a 100644
--- a/gck/tests/test-gck-object.c
+++ b/gck/tests/test-gck-object.c
@@ -301,8 +301,8 @@ DEFINE_TEST(set_attributes)
 	}
 
 	templ = gck_attributes_new ();
-	gck_attributes_add_ulong (attrs, CKA_CLASS, 7);
-	gck_attributes_add_string (attrs, CKA_LABEL, "CHANGE THREE");
+	gck_attributes_add_ulong (templ, CKA_CLASS, 7);
+	gck_attributes_add_string (templ, CKA_LABEL, "CHANGE THREE");
 
 	/* Async */
 	gck_object_set_async (object, templ, NULL, fetch_async_result, &result);
@@ -339,6 +339,7 @@ DEFINE_TEST(find_objects)
 	attrs = gck_attributes_new ();
 	gck_attributes_add_ulong (attrs, CKA_CLASS, CKO_DATA);
 	gck_attributes_add_string (attrs, CKA_LABEL, "OTHER LABEL");
+	testobj = gck_session_create_object (session, attrs, NULL, &err);
 	gck_attributes_unref (attrs);
 	g_object_unref (testobj);
 
diff --git a/gck/tests/test-gck-session.c b/gck/tests/test-gck-session.c
index 3cf535d..19495be 100644
--- a/gck/tests/test-gck-session.c
+++ b/gck/tests/test-gck-session.c
@@ -228,7 +228,6 @@ DEFINE_TEST(auto_login)
 	slot_with_auth = g_object_new (GCK_TYPE_SLOT, "module", module_with_auth, "handle", gck_slot_get_handle (slot), NULL);
 	new_session = gck_slot_open_session (slot_with_auth, CKF_RW_SESSION, &err);
 	SUCCESS_RES (new_session, err);
-	g_object_unref (new_session);
 
 	/* Try again to do something that requires a login */
 	object = gck_session_create_object (new_session, attrs, NULL, &err);
@@ -246,7 +245,6 @@ DEFINE_TEST(auto_login)
 	new_session = gck_slot_open_session_finish (slot_with_auth, result, &err);
 	SUCCESS_RES (new_session, err);
 	g_object_unref (result);
-	g_object_unref (new_session);
 
 	result = NULL;
 	gck_session_create_object_async (new_session, attrs, NULL, fetch_async_result, &result);
@@ -261,6 +259,8 @@ DEFINE_TEST(auto_login)
 	ret = gck_session_logout (new_session, &err);
 	SUCCESS_RES (ret, err);
 
+	g_object_unref (new_session);
+
 	g_object_unref (slot_with_auth);
 	g_object_unref (module_with_auth);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]