Lines Matching refs:test_ctx

60     struct sysdb_test_ctx *test_ctx;
72 test_ctx = talloc_zero(global_talloc_context, struct sysdb_test_ctx);
73 assert_non_null(test_ctx);
78 test_ctx->ev = tevent_context_init(test_ctx);
79 assert_non_null(test_ctx->ev);
81 conf_db = talloc_asprintf(test_ctx, "%s/%s", TESTS_PATH, TEST_CONF_FILE);
86 ret = confdb_init(test_ctx, &test_ctx->confdb, conf_db);
90 ret = confdb_add_param(test_ctx->confdb, true,
95 ret = confdb_add_param(test_ctx->confdb, true,
100 ret = confdb_add_param(test_ctx->confdb, true,
105 ret = confdb_add_param(test_ctx->confdb, true,
109 ret = sssd_domain_init(test_ctx, test_ctx->confdb, "local",
110 TESTS_PATH, &test_ctx->domain);
113 test_ctx->domain->has_views = true;
114 test_ctx->sysdb = test_ctx->domain->sysdb;
116 *ctx = test_ctx;
126 struct sysdb_test_ctx *test_ctx;
130 ret = setup_sysdb_tests(&test_ctx);
133 *state = (void *) test_ctx;
139 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
142 talloc_free(test_ctx);
158 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
161 test_ctx->domain->mpg = false;
162 name = sss_create_internal_fqname(test_ctx, TEST_USER_NAME,
163 test_ctx->domain->name);
166 ret = sysdb_store_user(test_ctx->domain, name, NULL,
172 ret = sysdb_search_user_by_name(test_ctx, test_ctx->domain, name,
178 ret = sysdb_store_override(test_ctx->domain, TEST_VIEW_NAME,
182 ret = sysdb_search_entry(test_ctx, test_ctx->domain->sysdb,msg->dn,
190 ret = sysdb_invalidate_overrides(test_ctx->domain->sysdb);
193 attrs = sysdb_new_attrs(test_ctx);
197 ret = sysdb_store_override(test_ctx->domain, TEST_VIEW_NAME,
206 ret = sysdb_store_override(test_ctx->domain, TEST_VIEW_NAME,
210 ret = sysdb_search_entry(test_ctx, test_ctx->domain->sysdb,msg->dn,
226 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
229 orig = ldb_msg_new(test_ctx);
242 override = ldb_msg_new(test_ctx);
266 ret = sysdb_add_overrides_to_object(test_ctx->domain, orig, override, NULL);
294 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
297 orig = ldb_msg_new(test_ctx);
310 test_ctx->domain->has_views = true;
311 test_ctx->domain->view_name = "LOCAL";
313 ret = sysdb_add_overrides_to_object(test_ctx->domain, orig, NULL, NULL);
322 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
325 orig = ldb_msg_new(test_ctx);
328 orig->dn = ldb_dn_new(orig, test_ctx->domain->sysdb->ldb,
342 test_ctx->domain->has_views = true;
343 test_ctx->domain->view_name = "NON-LOCAL";
345 ret = sysdb_add_overrides_to_object(test_ctx->domain, orig, NULL, NULL);
354 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
357 ret = split_ipa_anchor(test_ctx, NULL, &dom, &uuid);
360 ret = split_ipa_anchor(test_ctx, "fwfkwjfkw", &dom, &uuid);
363 ret = split_ipa_anchor(test_ctx, ":IPA:", &dom, &uuid);
366 ret = split_ipa_anchor(test_ctx, ":IPA:abc", &dom, &uuid);
369 ret = split_ipa_anchor(test_ctx, ":IPA:abc:", &dom, &uuid);
372 ret = split_ipa_anchor(test_ctx, ":IPA:abc:def", &dom, &uuid);
388 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
391 test_ctx->domain->mpg = false;
393 ret = sysdb_update_view_name(test_ctx->domain->sysdb, TEST_VIEW_NAME);
396 name = sss_create_internal_fqname(test_ctx, TEST_USER_NAME,
397 test_ctx->domain->name);
400 ret = sysdb_store_user(test_ctx->domain, name, NULL,
406 ret = sysdb_search_user_by_name(test_ctx, test_ctx->domain, name,
411 attrs = sysdb_new_attrs(test_ctx);
418 ret = sysdb_store_override(test_ctx->domain, TEST_VIEW_NAME,
422 views_dn = ldb_dn_new(test_ctx, test_ctx->domain->sysdb->ldb,
426 ret = sysdb_search_entry(test_ctx, test_ctx->domain->sysdb, views_dn,
432 ret = sysdb_delete_view_tree(test_ctx->domain->sysdb, TEST_VIEW_NAME);
435 ret = sysdb_search_entry(test_ctx, test_ctx->domain->sysdb, views_dn,
455 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
458 test_ctx->domain->mpg = false;
459 name = sss_create_internal_fqname(test_ctx, TEST_USER_NAME,
460 test_ctx->domain->name);
464 ret = sysdb_update_view_name(test_ctx->domain->sysdb, TEST_VIEW_NAME);
467 ret = sysdb_store_user(test_ctx->domain, name, NULL,
473 ret = sysdb_search_user_by_name(test_ctx, test_ctx->domain, name,
478 attrs = sysdb_new_attrs(test_ctx);
485 ret = sysdb_store_override(test_ctx->domain, TEST_VIEW_NAME,
489 views_dn = ldb_dn_new(test_ctx, test_ctx->domain->sysdb->ldb,
493 ret = sysdb_delete_view_tree(test_ctx->domain->sysdb, TEST_VIEW_NAME);
496 ret = sysdb_search_user_by_name(test_ctx, test_ctx->domain, name,
503 ret = sysdb_invalidate_overrides(test_ctx->domain->sysdb);
506 ret = sysdb_search_user_by_name(test_ctx, test_ctx->domain, name,
514 ret = sysdb_delete_user(test_ctx->domain, name, 0);
520 static void enum_test_user_override(struct sysdb_test_ctx *test_ctx,
530 tmp_ctx = talloc_new(test_ctx);
536 dn = sysdb_user_dn(tmp_ctx, test_ctx->domain, name);
547 ret = sysdb_store_override(test_ctx->domain, TEST_VIEW_NAME,
554 static void enum_test_add_users(struct sysdb_test_ctx *test_ctx,
563 attrs = talloc(test_ctx, struct sysdb_attrs);
565 fqname = sss_create_internal_fqname(test_ctx, usernames[i],
566 test_ctx->domain->name);
568 ret = sysdb_store_user(test_ctx->domain, fqname,
573 enum_test_user_override(test_ctx, fqname);
580 static void enum_test_del_users(struct sysdb_test_ctx *test_ctx,
588 fqname = sss_create_internal_fqname(test_ctx, usernames[i],
589 test_ctx->domain->name);
592 ret = sysdb_delete_user(test_ctx->domain, fqname, 0);
603 struct sysdb_test_ctx *test_ctx;
607 ret = setup_sysdb_enum_tests(&test_ctx);
610 enum_test_add_users(test_ctx, users);
612 *state = (void *) test_ctx;
676 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
679 enum_test_del_users(test_ctx, users);
698 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
702 ret = sysdb_enumpwent(test_ctx, test_ctx->domain, &res);
703 check_enumpwent(ret, test_ctx->domain, res, false);
709 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
713 ret = sysdb_enumpwent_with_views(test_ctx, test_ctx->domain, &res);
714 check_enumpwent(ret, test_ctx->domain, res, true);
720 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
725 ret = sysdb_enumpwent_filter(test_ctx, test_ctx->domain, "a*", 0, &res);
728 assert_user_attrs(res->msgs[0], test_ctx->domain, "alice", false);
730 ret = sysdb_enumpwent_filter(test_ctx, test_ctx->domain, "b*", 0, &res);
734 assert_user_attrs(res->msgs[0], test_ctx->domain, "barney", false);
735 assert_user_attrs(res->msgs[1], test_ctx->domain, "bob", false);
737 ret = sysdb_enumpwent_filter(test_ctx, test_ctx->domain, "c*", 0, &res);
741 ret = sysdb_enumpwent_filter(test_ctx, test_ctx->domain, "*", 0, &res);
746 addtl_filter = talloc_asprintf(test_ctx, "(%s<=%d)",
748 ret = sysdb_enumpwent_filter(test_ctx, test_ctx->domain, "a*", addtl_filter, &res);
753 addtl_filter = talloc_asprintf(test_ctx, "(%s<=%d)",
755 ret = sysdb_enumpwent_filter(test_ctx, test_ctx->domain, "a*", addtl_filter, &res);
759 assert_user_attrs(res->msgs[0], test_ctx->domain, "alice", false);
765 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
770 ret = sysdb_enumpwent_filter_with_views(test_ctx, test_ctx->domain,
774 assert_user_attrs(res->msgs[0], test_ctx->domain, "alice", true);
776 ret = sysdb_enumpwent_filter_with_views(test_ctx, test_ctx->domain,
781 assert_user_attrs(res->msgs[0], test_ctx->domain, "barney", true);
782 assert_user_attrs(res->msgs[1], test_ctx->domain, "bob", true);
784 addtl_filter = talloc_asprintf(test_ctx, "(%s<=%d)",
786 ret = sysdb_enumpwent_filter_with_views(test_ctx, test_ctx->domain,
791 assert_user_attrs(res->msgs[0], test_ctx->domain, "bob", true);
793 ret = sysdb_enumpwent_filter_with_views(test_ctx,
794 test_ctx->domain, "c*", NULL, &res);
798 ret = sysdb_enumpwent_filter_with_views(test_ctx,
799 test_ctx->domain, "*", NULL, &res);
800 check_enumpwent(ret, test_ctx->domain, res, true);
805 static void enum_test_group_override(struct sysdb_test_ctx *test_ctx,
815 tmp_ctx = talloc_new(test_ctx);
821 dn = sysdb_group_dn(tmp_ctx, test_ctx->domain, name);
831 ret = sysdb_store_override(test_ctx->domain, TEST_VIEW_NAME,
838 static void enum_test_add_groups(struct sysdb_test_ctx *test_ctx,
847 attrs = talloc(test_ctx, struct sysdb_attrs);
850 gr_name = sss_create_internal_fqname(test_ctx, groupnames[i],
851 test_ctx->domain->name);
852 ret = sysdb_store_group(test_ctx->domain, gr_name,
856 enum_test_group_override(test_ctx, gr_name,
879 struct sysdb_test_ctx *test_ctx;
883 ret = setup_sysdb_enum_tests(&test_ctx);
886 enum_test_add_groups(test_ctx, groups);
888 *state = (void *) test_ctx;
894 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
897 enum_test_del_groups(test_ctx->domain, groups);
940 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
944 ret = sysdb_enumgrent(test_ctx, test_ctx->domain, &res);
945 check_enumgrent(ret, test_ctx->domain, res, false);
951 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
955 ret = sysdb_enumgrent_with_views(test_ctx, test_ctx->domain, &res);
956 check_enumgrent(ret, test_ctx->domain, res, true);
962 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
967 ret = sysdb_enumgrent_filter(test_ctx, test_ctx->domain, "o*", 0, &res);
970 assert_group_attrs(res->msgs[0], test_ctx->domain, "one", 0);
972 ret = sysdb_enumgrent_filter(test_ctx, test_ctx->domain, "t*", 0, &res);
976 assert_group_attrs(res->msgs[0], test_ctx->domain, "three", 0);
977 assert_group_attrs(res->msgs[1], test_ctx->domain, "two", 0);
979 ret = sysdb_enumgrent_filter(test_ctx, test_ctx->domain, "x*", 0, &res);
983 ret = sysdb_enumgrent_filter(test_ctx, test_ctx->domain, "*", 0, &res);
984 check_enumgrent(ret, test_ctx->domain, res, false);
986 addtl_filter = talloc_asprintf(test_ctx, "(%s<=%d)",
988 ret = sysdb_enumgrent_filter(test_ctx, test_ctx->domain, "o*", addtl_filter, &res);
993 addtl_filter = talloc_asprintf(test_ctx, "(%s<=%d)",
995 ret = sysdb_enumgrent_filter(test_ctx, test_ctx->domain, "o*", addtl_filter, &res);
999 assert_group_attrs(res->msgs[0], test_ctx->domain, "one", 0);
1006 struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
1011 ret = sysdb_enumgrent_filter_with_views(test_ctx, test_ctx->domain,
1015 assert_group_attrs(res->msgs[0], test_ctx->domain,
1018 ret = sysdb_enumgrent_filter_with_views(test_ctx, test_ctx->domain,
1023 assert_group_attrs(res->msgs[0], test_ctx->domain,
1025 assert_group_attrs(res->msgs[1], test_ctx->domain, "two",
1028 addtl_filter = talloc_asprintf(test_ctx, "(%s<=%d)",
1030 ret = sysdb_enumgrent_filter_with_views(test_ctx, test_ctx->domain,
1035 assert_group_attrs(res->msgs[0], test_ctx->domain, "two",
1038 ret = sysdb_enumgrent_filter_with_views(test_ctx, test_ctx->domain,
1043 ret = sysdb_enumgrent_filter_with_views(test_ctx, test_ctx->domain,
1045 check_enumgrent(ret, test_ctx->domain, res, true);