summaryrefslogtreecommitdiffstats
path: root/src/tests/sysdb-tests.c
diff options
context:
space:
mode:
authorPavel Reichl <preichl@redhat.com>2014-12-09 09:47:11 +0000
committerSumit Bose <sbose@redhat.com>2014-12-17 15:57:23 +0100
commit13c0cf829eca7891ad9d0087e91c72650f990149 (patch)
tree6880c8c572ac4368422fc59267408ad80441c927 /src/tests/sysdb-tests.c
parenta183e279f754afdd571d8b084c7a36b71d5c1701 (diff)
downloadsssd-13c0cf829eca7891ad9d0087e91c72650f990149.tar.gz
sssd-13c0cf829eca7891ad9d0087e91c72650f990149.tar.xz
sssd-13c0cf829eca7891ad9d0087e91c72650f990149.zip
TESTS: sysdb_delete_by_sid() test return value
Check that return value of sysdb_delete_by_sid() is not changed as called SYSDB functions have changed the return value. Part of patches for: https://fedorahosted.org/sssd/ticket/1991 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/tests/sysdb-tests.c')
-rw-r--r--src/tests/sysdb-tests.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index b55901a30..d30398264 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -5127,7 +5127,28 @@ START_TEST(test_sysdb_search_object_by_uuid)
"UUIDuser") == 0, "Unexpected object found, " \
"expected [%s], got [%s].", "UUIDuser",
ldb_msg_find_attr_as_string(res->msgs[0],SYSDB_NAME, ""));
+ talloc_free(test_ctx);
+}
+END_TEST
+
+START_TEST(test_sysdb_delete_by_sid)
+{
+ errno_t ret;
+ struct sysdb_test_ctx *test_ctx;
+
+ /* Setup */
+ ret = setup_sysdb_tests(&test_ctx);
+ fail_if(ret != EOK, "Could not set up the test");
+ check_leaks_push(test_ctx);
+
+ /* Delete the group by SID */
+ ret = sysdb_delete_by_sid(test_ctx->sysdb, test_ctx->domain,
+ "S-1-2-3-4-NON_EXISTING_SID");
+ fail_unless(ret == EOK, "sysdb_delete_by_sid failed with [%d][%s].",
+ ret, strerror(ret));
+
+ fail_unless(check_leaks_pop(test_ctx) == true, "Memory leak");
talloc_free(test_ctx);
}
END_TEST
@@ -6175,6 +6196,7 @@ Suite *create_sysdb_suite(void)
tcase_add_test(tc_sysdb, test_sysdb_search_custom_update);
tcase_add_test(tc_sysdb, test_sysdb_search_custom);
tcase_add_test(tc_sysdb, test_sysdb_delete_custom);
+ tcase_add_test(tc_sysdb, test_sysdb_delete_by_sid);
/* test recursive delete */
tcase_add_test(tc_sysdb, test_sysdb_delete_recursive);