From 871b0cfc0ac908b58177ab6dd591f595621fc9d2 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 19 Jan 2012 11:47:06 +0100 Subject: empathy-tls-test: use g_assert_(no_)error() https://bugzilla.gnome.org/show_bug.cgi?id=668186 --- tests/empathy-tls-test.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'tests') diff --git a/tests/empathy-tls-test.c b/tests/empathy-tls-test.c index 8256da477..58c53dc6b 100644 --- a/tests/empathy-tls-test.c +++ b/tests/empathy-tls-test.c @@ -454,9 +454,10 @@ test_certificate_verify_success_with_pkcs11_lookup (Test *test, reference_identities); empathy_tls_verifier_verify_async (verifier, fetch_callback_result, test); g_main_loop_run (test->loop); - if (!empathy_tls_verifier_verify_finish (verifier, test->result, &reason, - NULL, &error)) - g_assert_not_reached (); + + empathy_tls_verifier_verify_finish (verifier, test->result, &reason, + NULL, &error); + g_assert_no_error (error); /* Yay the verification was a success! */ @@ -494,9 +495,9 @@ test_certificate_verify_success_with_full_chain (Test *test, reference_identities); empathy_tls_verifier_verify_async (verifier, fetch_callback_result, test); g_main_loop_run (test->loop); - if (!empathy_tls_verifier_verify_finish (verifier, test->result, &reason, - NULL, &error)) - g_assert_not_reached (); + empathy_tls_verifier_verify_finish (verifier, test->result, &reason, + NULL, &error); + g_assert_no_error (error); /* Yay the verification was a success! */ @@ -528,12 +529,12 @@ test_certificate_verify_root_not_found (Test *test, empathy_tls_verifier_verify_async (verifier, fetch_callback_result, test); g_main_loop_run (test->loop); - if (empathy_tls_verifier_verify_finish (verifier, test->result, &reason, - NULL, &error)) - g_assert_not_reached (); + empathy_tls_verifier_verify_finish (verifier, test->result, &reason, + NULL, &error); /* And it should say we're self-signed (oddly enough) */ - g_assert_cmpuint (reason, ==, EMP_TLS_CERTIFICATE_REJECT_REASON_SELF_SIGNED); + g_assert_error (error, G_IO_ERROR, + EMP_TLS_CERTIFICATE_REJECT_REASON_SELF_SIGNED); g_clear_error (&error); g_object_unref (verifier); @@ -563,12 +564,12 @@ test_certificate_verify_root_not_anchored (Test *test, empathy_tls_verifier_verify_async (verifier, fetch_callback_result, test); g_main_loop_run (test->loop); - if (empathy_tls_verifier_verify_finish (verifier, test->result, &reason, - NULL, &error)) - g_assert_not_reached (); + empathy_tls_verifier_verify_finish (verifier, test->result, &reason, + NULL, &error); /* And it should say we're self-signed (oddly enough) */ - g_assert_cmpuint (reason, ==, EMP_TLS_CERTIFICATE_REJECT_REASON_SELF_SIGNED); + g_assert_error (error, G_IO_ERROR, + EMP_TLS_CERTIFICATE_REJECT_REASON_SELF_SIGNED); g_clear_error (&error); g_object_unref (verifier); @@ -600,12 +601,12 @@ test_certificate_verify_identities_invalid (Test *test, empathy_tls_verifier_verify_async (verifier, fetch_callback_result, test); g_main_loop_run (test->loop); - if (empathy_tls_verifier_verify_finish (verifier, test->result, &reason, - NULL, &error)) - g_assert_not_reached (); + empathy_tls_verifier_verify_finish (verifier, test->result, &reason, + NULL, &error); /* And it should say we're self-signed (oddly enough) */ - g_assert_cmpuint (reason, ==, EMP_TLS_CERTIFICATE_REJECT_REASON_HOSTNAME_MISMATCH); + g_assert_error (error, G_IO_ERROR, + EMP_TLS_CERTIFICATE_REJECT_REASON_HOSTNAME_MISMATCH); g_clear_error (&error); g_object_unref (verifier); @@ -638,12 +639,12 @@ test_certificate_verify_uses_reference_identities (Test *test, empathy_tls_verifier_verify_async (verifier, fetch_callback_result, test); g_main_loop_run (test->loop); - if (empathy_tls_verifier_verify_finish (verifier, test->result, &reason, - NULL, &error)) - g_assert_not_reached (); + empathy_tls_verifier_verify_finish (verifier, test->result, &reason, + NULL, &error); /* And it should say we're self-signed (oddly enough) */ - g_assert_cmpuint (reason, ==, EMP_TLS_CERTIFICATE_REJECT_REASON_HOSTNAME_MISMATCH); + g_assert_error (error, G_IO_ERROR, + EMP_TLS_CERTIFICATE_REJECT_REASON_HOSTNAME_MISMATCH); g_clear_error (&error); g_object_unref (verifier); -- cgit v1.2.3