diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pin-test.c | 38 | ||||
-rw-r--r-- | tests/uri-test.c | 60 |
2 files changed, 49 insertions, 49 deletions
diff --git a/tests/pin-test.c b/tests/pin-test.c index 6431857..0117908 100644 --- a/tests/pin-test.c +++ b/tests/pin-test.c @@ -44,7 +44,7 @@ #include "p11-kit/pin.h" static P11KitPin * -callback_one (const char *pinfile, P11KitUri *pin_uri, const char *pin_description, +callback_one (const char *pin_source, P11KitUri *pin_uri, const char *pin_description, P11KitPinFlags pin_flags, void *callback_data) { int *data = callback_data; @@ -53,7 +53,7 @@ callback_one (const char *pinfile, P11KitUri *pin_uri, const char *pin_descripti } static P11KitPin* -callback_other (const char *pinfile, P11KitUri *pin_uri, const char *pin_description, +callback_other (const char *pin_source, P11KitUri *pin_uri, const char *pin_description, P11KitPinFlags pin_flags, void *callback_data) { char *data = callback_data; @@ -72,10 +72,10 @@ test_pin_register_unregister (CuTest *tc) { int data = 33; - p11_kit_pin_register_callback ("/the/pinfile", callback_one, + p11_kit_pin_register_callback ("/the/pin_source", callback_one, &data, destroy_data); - p11_kit_pin_unregister_callback ("/the/pinfile", callback_one, + p11_kit_pin_unregister_callback ("/the/pin_source", callback_one, &data); CuAssertIntEquals (tc, 34, data); @@ -90,11 +90,11 @@ test_pin_read (CuTest *tc) size_t length; const unsigned char *ptr; - p11_kit_pin_register_callback ("/the/pinfile", callback_one, + p11_kit_pin_register_callback ("/the/pin_source", callback_one, &data, destroy_data); uri = p11_kit_uri_new (); - pin = p11_kit_pin_request ("/the/pinfile", uri, "The token", + pin = p11_kit_pin_request ("/the/pin_source", uri, "The token", P11_KIT_PIN_FLAGS_USER_LOGIN); p11_kit_uri_free (uri); @@ -103,7 +103,7 @@ test_pin_read (CuTest *tc) CuAssertIntEquals (tc, 3, length); CuAssertTrue (tc, memcmp (ptr, "one", 3) == 0); - p11_kit_pin_unregister_callback ("/the/pinfile", callback_one, + p11_kit_pin_unregister_callback ("/the/pin_source", callback_one, &data); p11_kit_pin_ref (pin); @@ -117,7 +117,7 @@ test_pin_read_no_match (CuTest *tc) P11KitPin *pin; uri = p11_kit_uri_new (); - pin = p11_kit_pin_request ("/the/pinfile", uri, "The token", + pin = p11_kit_pin_request ("/the/pin_source", uri, "The token", P11_KIT_PIN_FLAGS_USER_LOGIN); p11_kit_uri_free (uri); @@ -136,13 +136,13 @@ test_pin_register_duplicate (CuTest *tc) uri = p11_kit_uri_new (); - p11_kit_pin_register_callback ("/the/pinfile", callback_one, + p11_kit_pin_register_callback ("/the/pin_source", callback_one, &data, destroy_data); - p11_kit_pin_register_callback ("/the/pinfile", callback_other, + p11_kit_pin_register_callback ("/the/pin_source", callback_other, value, NULL); - pin = p11_kit_pin_request ("/the/pinfile", uri, "The token", + pin = p11_kit_pin_request ("/the/pin_source", uri, "The token", P11_KIT_PIN_FLAGS_USER_LOGIN); CuAssertPtrNotNull (tc, pin); @@ -151,10 +151,10 @@ test_pin_register_duplicate (CuTest *tc) CuAssertTrue (tc, memcmp (ptr, "secret", length) == 0); p11_kit_pin_unref (pin); - p11_kit_pin_unregister_callback ("/the/pinfile", callback_other, + p11_kit_pin_unregister_callback ("/the/pin_source", callback_other, value); - pin = p11_kit_pin_request ("/the/pinfile", uri, "The token", + pin = p11_kit_pin_request ("/the/pin_source", uri, "The token", P11_KIT_PIN_FLAGS_USER_LOGIN); CuAssertPtrNotNull (tc, pin); @@ -163,10 +163,10 @@ test_pin_register_duplicate (CuTest *tc) CuAssertTrue (tc, memcmp (ptr, "one", length) == 0); p11_kit_pin_unref (pin); - p11_kit_pin_unregister_callback ("/the/pinfile", callback_one, + p11_kit_pin_unregister_callback ("/the/pin_source", callback_one, &data); - pin = p11_kit_pin_request ("/the/pinfile", uri, "The token", + pin = p11_kit_pin_request ("/the/pin_source", uri, "The token", P11_KIT_PIN_FLAGS_USER_LOGIN); CuAssertPtrEquals (tc, NULL, pin); @@ -189,7 +189,7 @@ test_pin_register_fallback (CuTest *tc) p11_kit_pin_register_callback (P11_KIT_PIN_FALLBACK, callback_one, &data, destroy_data); - pin = p11_kit_pin_request ("/the/pinfile", uri, "The token", + pin = p11_kit_pin_request ("/the/pin_source", uri, "The token", P11_KIT_PIN_FLAGS_USER_LOGIN); CuAssertPtrNotNull (tc, pin); @@ -198,10 +198,10 @@ test_pin_register_fallback (CuTest *tc) CuAssertTrue (tc, memcmp (ptr, "one", length) == 0); p11_kit_pin_unref (pin); - p11_kit_pin_register_callback ("/the/pinfile", callback_other, + p11_kit_pin_register_callback ("/the/pin_source", callback_other, value, NULL); - pin = p11_kit_pin_request ("/the/pinfile", uri, "The token", + pin = p11_kit_pin_request ("/the/pin_source", uri, "The token", P11_KIT_PIN_FLAGS_USER_LOGIN); CuAssertPtrNotNull (tc, pin); @@ -210,7 +210,7 @@ test_pin_register_fallback (CuTest *tc) CuAssertTrue (tc, memcmp (ptr, "secret", length) == 0); p11_kit_pin_unref (pin); - p11_kit_pin_unregister_callback ("/the/pinfile", callback_other, + p11_kit_pin_unregister_callback ("/the/pin_source", callback_other, value); p11_kit_pin_unregister_callback (P11_KIT_PIN_FALLBACK, callback_one, diff --git a/tests/uri-test.c b/tests/uri-test.c index d5ca423..8ab8f93 100644 --- a/tests/uri-test.c +++ b/tests/uri-test.c @@ -138,7 +138,7 @@ test_uri_parse_with_label_and_klass (CuTest *tc) uri = p11_kit_uri_new (); CuAssertPtrNotNull (tc, uri); - ret = p11_kit_uri_parse ("pkcs11:object=Test%20Label;objecttype=cert", P11_KIT_URI_FOR_ANY, uri); + ret = p11_kit_uri_parse ("pkcs11:object=Test%20Label;object-type=cert", P11_KIT_URI_FOR_ANY, uri); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); attr = p11_kit_uri_get_attribute (uri, CKA_LABEL); @@ -485,7 +485,7 @@ test_uri_build_with_attributes (CuTest *tc) p11_kit_uri_free (check); CuAssertTrue (tc, strstr (string, "object=The%20Label") != NULL); - CuAssertTrue (tc, strstr (string, "objecttype=data") != NULL); + CuAssertTrue (tc, strstr (string, "object-type=data") != NULL); CuAssertTrue (tc, strstr (string, "id=HELLO") != NULL); free (string); @@ -502,7 +502,7 @@ test_uri_parse_private_key (CuTest *tc) uri = p11_kit_uri_new (); CuAssertPtrNotNull (tc, uri); - ret = p11_kit_uri_parse ("pkcs11:objecttype=private", P11_KIT_URI_FOR_OBJECT, uri); + ret = p11_kit_uri_parse ("pkcs11:object-type=private", P11_KIT_URI_FOR_OBJECT, uri); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); attr = p11_kit_uri_get_attribute (uri, CKA_CLASS); @@ -523,7 +523,7 @@ test_uri_parse_secret_key (CuTest *tc) uri = p11_kit_uri_new (); CuAssertPtrNotNull (tc, uri); - ret = p11_kit_uri_parse ("pkcs11:objecttype=secretkey", P11_KIT_URI_FOR_OBJECT, uri); + ret = p11_kit_uri_parse ("pkcs11:object-type=secret-key", P11_KIT_URI_FOR_OBJECT, uri); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); attr = p11_kit_uri_get_attribute (uri, CKA_CLASS); @@ -577,7 +577,7 @@ test_uri_parse_library_version (CuTest *tc) } static void -test_uri_parse_parse_unknown_objecttype (CuTest *tc) +test_uri_parse_parse_unknown_object_type (CuTest *tc) { P11KitUri *uri; CK_ATTRIBUTE_PTR attr; @@ -586,7 +586,7 @@ test_uri_parse_parse_unknown_objecttype (CuTest *tc) uri = p11_kit_uri_new (); CuAssertPtrNotNull (tc, uri); - ret = p11_kit_uri_parse ("pkcs11:objecttype=unknown", P11_KIT_URI_FOR_OBJECT, uri); + ret = p11_kit_uri_parse ("pkcs11:object-type=unknown", P11_KIT_URI_FOR_OBJECT, uri); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); attr = p11_kit_uri_get_attribute (uri, CKA_CLASS); @@ -635,7 +635,7 @@ test_uri_parse_too_long_is_unrecognized (CuTest *tc) static void -test_uri_build_objecttype_cert (CuTest *tc) +test_uri_build_object_type_cert (CuTest *tc) { CK_ATTRIBUTE attr; CK_OBJECT_CLASS klass; @@ -654,14 +654,14 @@ test_uri_build_objecttype_cert (CuTest *tc) ret = p11_kit_uri_format (uri, P11_KIT_URI_FOR_ANY, &string); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); - CuAssertTrue (tc, strstr (string, "objecttype=cert") != NULL); + CuAssertTrue (tc, strstr (string, "object-type=cert") != NULL); p11_kit_uri_free (uri); free (string); } static void -test_uri_build_objecttype_private (CuTest *tc) +test_uri_build_object_type_private (CuTest *tc) { CK_ATTRIBUTE attr; CK_OBJECT_CLASS klass; @@ -680,14 +680,14 @@ test_uri_build_objecttype_private (CuTest *tc) ret = p11_kit_uri_format (uri, P11_KIT_URI_FOR_ANY, &string); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); - CuAssertTrue (tc, strstr (string, "objecttype=private") != NULL); + CuAssertTrue (tc, strstr (string, "object-type=private") != NULL); p11_kit_uri_free (uri); free (string); } static void -test_uri_build_objecttype_public (CuTest *tc) +test_uri_build_object_type_public (CuTest *tc) { CK_ATTRIBUTE attr; CK_OBJECT_CLASS klass; @@ -706,14 +706,14 @@ test_uri_build_objecttype_public (CuTest *tc) ret = p11_kit_uri_format (uri, P11_KIT_URI_FOR_ANY, &string); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); - CuAssertTrue (tc, strstr (string, "objecttype=public") != NULL); + CuAssertTrue (tc, strstr (string, "object-type=public") != NULL); p11_kit_uri_free (uri); free (string); } static void -test_uri_build_objecttype_secret (CuTest *tc) +test_uri_build_object_type_secret (CuTest *tc) { CK_ATTRIBUTE attr; CK_OBJECT_CLASS klass; @@ -732,7 +732,7 @@ test_uri_build_objecttype_secret (CuTest *tc) ret = p11_kit_uri_format (uri, P11_KIT_URI_FOR_ANY, &string); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); - CuAssertTrue (tc, strstr (string, "objecttype=secretkey") != NULL); + CuAssertTrue (tc, strstr (string, "object-type=secret-key") != NULL); p11_kit_uri_free (uri); free (string); @@ -910,7 +910,7 @@ test_uri_match_attributes (CuTest *tc) uri = p11_kit_uri_new (); CuAssertPtrNotNull (tc, uri); - ret = p11_kit_uri_parse ("pkcs11:object=Fancy;id=Blah;objecttype=data", P11_KIT_URI_FOR_ANY, uri); + ret = p11_kit_uri_parse ("pkcs11:object=Fancy;id=Blah;object-type=data", P11_KIT_URI_FOR_ANY, uri); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); ret = p11_kit_uri_match_attributes (uri, attrs, 4); @@ -1086,31 +1086,31 @@ test_uri_get_set_attributes (CuTest *tc) p11_kit_uri_free (uri); } static void -test_uri_pinfile (CuTest *tc) +test_uri_pin_source (CuTest *tc) { P11KitUri *uri; - const char *pinfile; + const char *pin_source; char *string; int ret; uri = p11_kit_uri_new (); CuAssertPtrNotNull (tc, uri); - p11_kit_uri_set_pinfile (uri, "|my-pin-file"); + p11_kit_uri_set_pin_source (uri, "|my-pin-file"); - pinfile = p11_kit_uri_get_pinfile (uri); - CuAssertStrEquals (tc, "|my-pin-file", pinfile); + pin_source = p11_kit_uri_get_pin_source (uri); + CuAssertStrEquals (tc, "|my-pin-file", pin_source); ret = p11_kit_uri_format (uri, P11_KIT_URI_FOR_ANY, &string); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); - CuAssertTrue (tc, strstr (string, "pinfile=%7cmy-pin-file") != NULL); + CuAssertTrue (tc, strstr (string, "pin-source=%7cmy-pin-file") != NULL); free (string); - ret = p11_kit_uri_parse ("pkcs11:pinfile=blah%2Fblah", P11_KIT_URI_FOR_ANY, uri); + ret = p11_kit_uri_parse ("pkcs11:pin-source=blah%2Fblah", P11_KIT_URI_FOR_ANY, uri); CuAssertIntEquals (tc, P11_KIT_URI_OK, ret); - pinfile = p11_kit_uri_get_pinfile (uri); - CuAssertStrEquals (tc, "blah/blah", pinfile); + pin_source = p11_kit_uri_get_pin_source (uri); + CuAssertStrEquals (tc, "blah/blah", pin_source); p11_kit_uri_free (uri); } @@ -1156,13 +1156,13 @@ main (void) SUITE_ADD_TEST (suite, test_uri_parse_private_key); SUITE_ADD_TEST (suite, test_uri_parse_secret_key); SUITE_ADD_TEST (suite, test_uri_parse_library_version); - SUITE_ADD_TEST (suite, test_uri_parse_parse_unknown_objecttype); + SUITE_ADD_TEST (suite, test_uri_parse_parse_unknown_object_type); SUITE_ADD_TEST (suite, test_uri_parse_unrecognized); SUITE_ADD_TEST (suite, test_uri_parse_too_long_is_unrecognized); - SUITE_ADD_TEST (suite, test_uri_build_objecttype_cert); - SUITE_ADD_TEST (suite, test_uri_build_objecttype_private); - SUITE_ADD_TEST (suite, test_uri_build_objecttype_public); - SUITE_ADD_TEST (suite, test_uri_build_objecttype_secret); + SUITE_ADD_TEST (suite, test_uri_build_object_type_cert); + SUITE_ADD_TEST (suite, test_uri_build_object_type_private); + SUITE_ADD_TEST (suite, test_uri_build_object_type_public); + SUITE_ADD_TEST (suite, test_uri_build_object_type_secret); SUITE_ADD_TEST (suite, test_uri_build_with_library); SUITE_ADD_TEST (suite, test_uri_build_library_version); SUITE_ADD_TEST (suite, test_uri_get_set_unrecognized); @@ -1171,7 +1171,7 @@ main (void) SUITE_ADD_TEST (suite, test_uri_match_attributes); SUITE_ADD_TEST (suite, test_uri_get_set_attribute); SUITE_ADD_TEST (suite, test_uri_get_set_attributes); - SUITE_ADD_TEST (suite, test_uri_pinfile); + SUITE_ADD_TEST (suite, test_uri_pin_source); SUITE_ADD_TEST (suite, test_uri_free_null); SUITE_ADD_TEST (suite, test_uri_message); |