Blame SOURCES/0141-TESTS-sysdb_delete_by_sid-test-return-value.patch

905b4d
From 13c0cf829eca7891ad9d0087e91c72650f990149 Mon Sep 17 00:00:00 2001
905b4d
From: Pavel Reichl <preichl@redhat.com>
905b4d
Date: Tue, 9 Dec 2014 09:47:11 +0000
905b4d
Subject: [PATCH 2/7] TESTS: sysdb_delete_by_sid() test return value
905b4d
MIME-Version: 1.0
905b4d
Content-Type: text/plain; charset=UTF-8
905b4d
Content-Transfer-Encoding: 8bit
905b4d
905b4d
Check that return value of sysdb_delete_by_sid() is not changed as
905b4d
called SYSDB functions have changed the return value.
905b4d
905b4d
Part of patches for:
905b4d
https://fedorahosted.org/sssd/ticket/1991
905b4d
905b4d
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
905b4d
---
905b4d
 src/tests/sysdb-tests.c | 22 ++++++++++++++++++++++
905b4d
 1 file changed, 22 insertions(+)
905b4d
905b4d
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
905b4d
index b55901a30feb94cd8199eab096785a02dfc89b9a..d303982647547eefdce7c37ac5b70e1ffbe869ce 100644
905b4d
--- a/src/tests/sysdb-tests.c
905b4d
+++ b/src/tests/sysdb-tests.c
905b4d
@@ -5127,7 +5127,28 @@ START_TEST(test_sysdb_search_object_by_uuid)
905b4d
                       "UUIDuser") == 0, "Unexpected object found, " \
905b4d
                       "expected [%s], got [%s].", "UUIDuser",
905b4d
                       ldb_msg_find_attr_as_string(res->msgs[0],SYSDB_NAME, ""));
905b4d
+    talloc_free(test_ctx);
905b4d
+}
905b4d
+END_TEST
905b4d
 
905b4d
+START_TEST(test_sysdb_delete_by_sid)
905b4d
+{
905b4d
+    errno_t ret;
905b4d
+    struct sysdb_test_ctx *test_ctx;
905b4d
+
905b4d
+    /* Setup */
905b4d
+    ret = setup_sysdb_tests(&test_ctx);
905b4d
+    fail_if(ret != EOK, "Could not set up the test");
905b4d
+
905b4d
+    check_leaks_push(test_ctx);
905b4d
+
905b4d
+    /* Delete the group by SID */
905b4d
+    ret = sysdb_delete_by_sid(test_ctx->sysdb, test_ctx->domain,
905b4d
+                              "S-1-2-3-4-NON_EXISTING_SID");
905b4d
+    fail_unless(ret == EOK, "sysdb_delete_by_sid failed with [%d][%s].",
905b4d
+                ret, strerror(ret));
905b4d
+
905b4d
+    fail_unless(check_leaks_pop(test_ctx) == true, "Memory leak");
905b4d
     talloc_free(test_ctx);
905b4d
 }
905b4d
 END_TEST
905b4d
@@ -6175,6 +6196,7 @@ Suite *create_sysdb_suite(void)
905b4d
     tcase_add_test(tc_sysdb, test_sysdb_search_custom_update);
905b4d
     tcase_add_test(tc_sysdb, test_sysdb_search_custom);
905b4d
     tcase_add_test(tc_sysdb, test_sysdb_delete_custom);
905b4d
+    tcase_add_test(tc_sysdb, test_sysdb_delete_by_sid);
905b4d
 
905b4d
     /* test recursive delete */
905b4d
     tcase_add_test(tc_sysdb, test_sysdb_delete_recursive);
905b4d
-- 
905b4d
1.9.3
905b4d