diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2014-05-15 23:11:54 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-05-22 17:36:27 +0200 |
commit | 5de968e80ade1c02d1907834dcff95e9fc9ad10a (patch) | |
tree | d8f66b2e8ba3a330afb823db80b51ba3527c0fc4 /src/tests/sbus_codegen_tests.c | |
parent | 58229439447d5617913a5a2e173b78105c694842 (diff) | |
download | sssd-5de968e80ade1c02d1907834dcff95e9fc9ad10a.tar.gz sssd-5de968e80ade1c02d1907834dcff95e9fc9ad10a.tar.xz sssd-5de968e80ade1c02d1907834dcff95e9fc9ad10a.zip |
SBUS: Return / if an object path getter returns NULL
Reviewed-by: Stef Walter <stefw@redhat.com>
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/tests/sbus_codegen_tests.c')
-rw-r--r-- | src/tests/sbus_codegen_tests.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tests/sbus_codegen_tests.c b/src/tests/sbus_codegen_tests.c index e92c5f784..c7da414fe 100644 --- a/src/tests/sbus_codegen_tests.c +++ b/src/tests/sbus_codegen_tests.c @@ -441,6 +441,13 @@ void pilot_get_null_string_handler(struct sbus_request *dbus_req, *string_val = NULL; } +void pilot_get_null_path_handler(struct sbus_request *dbus_req, + void *instance_data, + const char **path_val) +{ + *path_val = NULL; +} + #define array_getter_body(in, out, outlen) do { \ ck_assert(dbus_req != NULL); \ ck_assert(out != NULL); \ @@ -548,6 +555,7 @@ struct test_pilot pilot_iface = { .test_pilot_get_string = pilot_get_string_handler, .test_pilot_get_object_path = pilot_get_objpath_handler, .test_pilot_get_null_string = pilot_get_null_string_handler, + .test_pilot_get_null_path = pilot_get_null_path_handler, .test_pilot_get_byte_array = pilot_get_byte_array_handler, .test_pilot_get_int16_array = pilot_get_int16_array_handler, @@ -857,6 +865,12 @@ START_TEST(test_get_basic_types) call_get(client, "/test/leela", test_pilot_meta.name, "null_string", DBUS_TYPE_STRING, &string_val); ck_assert_str_eq(string_val, ""); + + /* If a string getter returns NULL, the caller should receive "/" */ + call_get(client, "/test/leela", test_pilot_meta.name, "null_path", + DBUS_TYPE_OBJECT_PATH, &path_val); + ck_assert_str_eq(path_val, "/"); + } END_TEST |