diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-01-19 18:47:06 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-01-19 18:58:09 +0800 |
commit | 871b0cfc0ac908b58177ab6dd591f595621fc9d2 (patch) | |
tree | aaa714a67003b29dbeebb1da0029c8682d414259 /tests | |
parent | 695ff499339de5c99023a227ff022d8a70466436 (diff) | |
download | gsoc2013-empathy-871b0cfc0ac908b58177ab6dd591f595621fc9d2.tar gsoc2013-empathy-871b0cfc0ac908b58177ab6dd591f595621fc9d2.tar.gz gsoc2013-empathy-871b0cfc0ac908b58177ab6dd591f595621fc9d2.tar.bz2 gsoc2013-empathy-871b0cfc0ac908b58177ab6dd591f595621fc9d2.tar.lz gsoc2013-empathy-871b0cfc0ac908b58177ab6dd591f595621fc9d2.tar.xz gsoc2013-empathy-871b0cfc0ac908b58177ab6dd591f595621fc9d2.tar.zst gsoc2013-empathy-871b0cfc0ac908b58177ab6dd591f595621fc9d2.zip |
empathy-tls-test: use g_assert_(no_)error()
https://bugzilla.gnome.org/show_bug.cgi?id=668186
Diffstat (limited to 'tests')
-rw-r--r-- | tests/empathy-tls-test.c | 45 |
1 files changed, 23 insertions, 22 deletions
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); |