From 338af078fcc18126df939f20182acea7a646b7c8 Mon Sep 17 00:00:00 2001 From: Michal Zidek Date: Tue, 5 Apr 2016 12:52:16 +0200 Subject: TESTS: Fix the ldap_id_cleanup test for using qualified names in sysdb Reviewed-by: Jakub Hrozek --- src/tests/cmocka/test_ldap_id_cleanup.c | 38 +++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'src/tests') diff --git a/src/tests/cmocka/test_ldap_id_cleanup.c b/src/tests/cmocka/test_ldap_id_cleanup.c index e40f2b6dd..fc6ddd274 100644 --- a/src/tests/cmocka/test_ldap_id_cleanup.c +++ b/src/tests/cmocka/test_ldap_id_cleanup.c @@ -182,16 +182,42 @@ static void test_id_cleanup_exp_group(void **state) errno_t ret; struct ldb_message *msg; struct sdap_domain sdom; - const char *special_grp = "special_gr*o/u\\p(2016)"; - const char *empty_special_grp = "empty_gr*o/u\\p(2016)"; - const char *empty_grp = "empty_grp"; - const char *grp = "grp"; + char *special_grp; + char *empty_special_grp; + char *empty_grp; + char *grp; + char *test_user; + char *test_user2; /* This timeout can be bigger because we will call invalidate_group * to expire entries without waiting. */ const uint64_t CACHE_TIMEOUT = 30; struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state, struct sysdb_test_ctx); + special_grp = sss_create_internal_fqname(test_ctx, + "special_gr*o/u\\p(2016)", + test_ctx->domain->name); + assert_non_null(special_grp); + + empty_special_grp = sss_create_internal_fqname(test_ctx, + "empty_gr*o/u\\p(2016)", + test_ctx->domain->name); + assert_non_null(empty_special_grp); + + empty_grp = sss_create_internal_fqname(test_ctx, "empty_grp", + test_ctx->domain->name); + assert_non_null(empty_grp); + + grp = sss_create_internal_fqname(test_ctx, "grp", test_ctx->domain->name); + assert_non_null(grp); + + test_user = sss_create_internal_fqname(test_ctx, "test_user", + test_ctx->domain->name); + assert_non_null(test_user); + test_user2 = sss_create_internal_fqname(test_ctx, "test_user2", + test_ctx->domain->name); + assert_non_null(test_user2); + ret = sysdb_store_group(test_ctx->domain, special_grp, 10002, NULL, CACHE_TIMEOUT, 0); assert_int_equal(ret, EOK); @@ -208,13 +234,13 @@ static void test_id_cleanup_exp_group(void **state) 10005, NULL, CACHE_TIMEOUT, 0); assert_int_equal(ret, EOK); - ret = sysdb_store_user(test_ctx->domain, "test_user", NULL, + ret = sysdb_store_user(test_ctx->domain, test_user, NULL, 10001, 10002, "Test user", NULL, NULL, NULL, NULL, NULL, 0, 0); assert_int_equal(ret, EOK); - ret = sysdb_store_user(test_ctx->domain, "test_user2", NULL, + ret = sysdb_store_user(test_ctx->domain, test_user2, NULL, 10002, 10004, "Test user", NULL, NULL, NULL, NULL, NULL, 0, 0); -- cgit