test_utils.c revision f64296c40e07614668c4ac4c978bc8980fb6a7db
af84459fbf938e508fd10b01cb8d699c79083813takashi Sumit Bose <sbose@redhat.com>
af84459fbf938e508fd10b01cb8d699c79083813takashi Copyright (C) 2013 Red Hat
af84459fbf938e508fd10b01cb8d699c79083813takashi SSSD tests: Tests for utility functions
af84459fbf938e508fd10b01cb8d699c79083813takashi This program is free software; you can redistribute it and/or modify
af84459fbf938e508fd10b01cb8d699c79083813takashi it under the terms of the GNU General Public License as published by
af84459fbf938e508fd10b01cb8d699c79083813takashi the Free Software Foundation; either version 3 of the License, or
af84459fbf938e508fd10b01cb8d699c79083813takashi (at your option) any later version.
af84459fbf938e508fd10b01cb8d699c79083813takashi This program is distributed in the hope that it will be useful,
af84459fbf938e508fd10b01cb8d699c79083813takashi but WITHOUT ANY WARRANTY; without even the implied warranty of
af84459fbf938e508fd10b01cb8d699c79083813takashi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
af84459fbf938e508fd10b01cb8d699c79083813takashi GNU General Public License for more details.
af84459fbf938e508fd10b01cb8d699c79083813takashi You should have received a copy of the GNU General Public License
af84459fbf938e508fd10b01cb8d699c79083813takashi along with this program. If not, see <http://www.gnu.org/licenses/>.
af84459fbf938e508fd10b01cb8d699c79083813takashi test_ctx = talloc_zero(global_talloc_context, struct dom_list_test_ctx);
af84459fbf938e508fd10b01cb8d699c79083813takashi dom = talloc_zero(test_ctx, struct sss_domain_info);
af84459fbf938e508fd10b01cb8d699c79083813takashi dom->flat_name = talloc_asprintf(dom, FLATNAME_TMPL, c);
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe dom = find_subdomain_by_sid(test_ctx->dom_list, NULL);
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe name = talloc_asprintf(global_talloc_context, DOMNAME_TMPL, c);
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe flat_name = talloc_asprintf(global_talloc_context, FLATNAME_TMPL, c);
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowevoid test_find_subdomain_by_sid_missing_sid(void **state)
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe for (c = 0; c < mis; c++) {
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe name = talloc_asprintf(global_talloc_context, DOMNAME_TMPL, c);
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe flat_name = talloc_asprintf(global_talloc_context, FLATNAME_TMPL, c);
f039cf01b271a31e317d5b84f24cb135f1c1b6d7nd sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
af84459fbf938e508fd10b01cb8d699c79083813takashi dom = find_subdomain_by_sid(test_ctx->dom_list, sid);
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe unit_test_setup_teardown(test_find_subdomain_by_sid_null,
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe unit_test_setup_teardown(test_find_subdomain_by_sid_missing_sid,
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe /* Set debug level to invalid value so we can deside if -d 0 was used. */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe pc = poptGetContext(argv[0], argc, argv, long_options, 0);
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe /* Even though normally the tests should clean up after themselves
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * they might not after a failed run. Remove the old db to be sure */