diff options
author | Michal Zidek <mzidek@redhat.com> | 2016-04-05 12:52:16 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-07-07 10:25:05 +0200 |
commit | 338af078fcc18126df939f20182acea7a646b7c8 (patch) | |
tree | d9bf92438d8b03534c61824cf17fa05fdbc64e57 | |
parent | a68e17d8fdc265d40e6f4a7d21a6d287a4bf23d5 (diff) | |
download | sssd-338af078fcc18126df939f20182acea7a646b7c8.tar.gz sssd-338af078fcc18126df939f20182acea7a646b7c8.tar.xz sssd-338af078fcc18126df939f20182acea7a646b7c8.zip |
TESTS: Fix the ldap_id_cleanup test for using qualified names in sysdb
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r-- | Makefile.am | 28 | ||||
-rw-r--r-- | src/tests/cmocka/test_ldap_id_cleanup.c | 38 |
2 files changed, 46 insertions, 20 deletions
diff --git a/Makefile.am b/Makefile.am index b4a895cf5..c6357588b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -262,7 +262,7 @@ if HAVE_CMOCKA test_tools_colondb \ test_krb5_wait_queue \ test_cert_utils \ - #test_ldap_id_cleanup \ + test_ldap_id_cleanup \ test_data_provider_be \ test_dp_request_table \ test_dp_request \ @@ -2405,19 +2405,19 @@ test_ldap_auth_LDADD = \ libdlopen_test_providers.la \ $(NULL) -#test_ldap_id_cleanup_SOURCES = \ -# src/tests/cmocka/test_ldap_id_cleanup.c \ -# $(NULL) -#test_ldap_id_cleanup_LDADD = \ -# $(CMOCKA_LIBS) \ -# $(POPT_LIBS) \ -# $(TALLOC_LIBS) \ -# $(TEVENT_LIBS) \ -# $(SSSD_INTERNAL_LTLIBS) \ -# libsss_ldap_common.la \ -# libsss_test_common.la \ -# libdlopen_test_providers.la \ -# $(NULL) +test_ldap_id_cleanup_SOURCES = \ + src/tests/cmocka/test_ldap_id_cleanup.c \ + $(NULL) +test_ldap_id_cleanup_LDADD = \ + $(CMOCKA_LIBS) \ + $(POPT_LIBS) \ + $(TALLOC_LIBS) \ + $(TEVENT_LIBS) \ + $(SSSD_INTERNAL_LTLIBS) \ + libsss_ldap_common.la \ + libsss_test_common.la \ + libdlopen_test_providers.la \ + $(NULL) test_sdap_access_SOURCES = \ src/tests/cmocka/test_sdap_access.c \ 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); |