From 0052abe2cb5a16dd105bfcaaaf691d5c389bcb62 Mon Sep 17 00:00:00 2001 From: Fabiano FidĂȘncio Date: Jul 12 2018 07:19:24 +0000 Subject: tests: add a test to ensure the output_fqnames is false for files provider Related: https://pagure.io/SSSD/sssd/issue/3743 Signed-off-by: Fabiano FidĂȘncio Reviewed-by: Sumit Bose --- diff --git a/src/tests/cmocka/test_domain_resolution_order.c b/src/tests/cmocka/test_domain_resolution_order.c index ce09c73..fcbe08b 100644 --- a/src/tests/cmocka/test_domain_resolution_order.c +++ b/src/tests/cmocka/test_domain_resolution_order.c @@ -93,6 +93,34 @@ test_domain_resolution_order_with_implicit_files_provider(void **state) } } +static void test_domain_resolution_order_output_fqnames(void **state) +{ + struct domain_resolution_order_test_ctx *test_ctx; + struct cache_req_domain *cr_domains = NULL; + struct cache_req_domain *cr_domain; + errno_t ret; + + test_ctx = talloc_get_type(*state, + struct domain_resolution_order_test_ctx); + + cr_domains = talloc_zero(test_ctx, struct cache_req_domain); + ret = cache_req_domain_new_list_from_domain_resolution_order( + test_ctx, + test_ctx->dom_list, + DOMAIN_RESOLUTION_ORDER, + &cr_domains); + assert_int_equal(ret, EOK); + + for (cr_domain = cr_domains; cr_domain != NULL; + cr_domain = cr_domain->next) { + struct sss_domain_info *dom = cr_domain->domain; + bool expected = !is_files_provider(dom); + bool output_fqnames = sss_domain_info_get_output_fqnames(dom); + + assert_true(expected == output_fqnames); + } +} + static int setup_domains_list_helper(void **state, bool with_files_provider) { struct domain_resolution_order_test_ctx *test_ctx; @@ -172,6 +200,10 @@ int main(int argc, const char *argv[]) test_domain_resolution_order_with_implicit_files_provider, setup_domains_list_with_implicit_files_provider, teardown_domains_list), + cmocka_unit_test_setup_teardown( + test_domain_resolution_order_output_fqnames, + setup_domains_list_with_implicit_files_provider, + teardown_domains_list), }; /* Set debug level to invalid value so we can decide if -d 0 was used. */