Commit 0052abe tests: add a test to ensure the output_fqnames is false for files provider

1 file Authored and Committed by fidencio 2 months ago
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 <fidencio@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>

    
 1 @@ -93,6 +93,34 @@
 2       }
 3   }
 4   
 5 + static void test_domain_resolution_order_output_fqnames(void **state)
 6 + {
 7 +     struct domain_resolution_order_test_ctx *test_ctx;
 8 +     struct cache_req_domain *cr_domains = NULL;
 9 +     struct cache_req_domain *cr_domain;
10 +     errno_t ret;
11 + 
12 +     test_ctx = talloc_get_type(*state,
13 +                                struct domain_resolution_order_test_ctx);
14 + 
15 +     cr_domains = talloc_zero(test_ctx, struct cache_req_domain);
16 +     ret = cache_req_domain_new_list_from_domain_resolution_order(
17 +                                                     test_ctx,
18 +                                                     test_ctx->dom_list,
19 +                                                     DOMAIN_RESOLUTION_ORDER,
20 +                                                     &cr_domains);
21 +     assert_int_equal(ret, EOK);
22 + 
23 +     for (cr_domain = cr_domains; cr_domain != NULL;
24 +             cr_domain = cr_domain->next) {
25 +         struct sss_domain_info *dom = cr_domain->domain;
26 +         bool expected = !is_files_provider(dom);
27 +         bool output_fqnames = sss_domain_info_get_output_fqnames(dom);
28 + 
29 +         assert_true(expected == output_fqnames);
30 +     }
31 + }
32 + 
33   static int setup_domains_list_helper(void **state, bool with_files_provider)
34   {
35       struct domain_resolution_order_test_ctx *test_ctx;
36 @@ -172,6 +200,10 @@
37                       test_domain_resolution_order_with_implicit_files_provider,
38                       setup_domains_list_with_implicit_files_provider,
39                       teardown_domains_list),
40 +         cmocka_unit_test_setup_teardown(
41 +                     test_domain_resolution_order_output_fqnames,
42 +                     setup_domains_list_with_implicit_files_provider,
43 +                     teardown_domains_list),
44       };
45   
46       /* Set debug level to invalid value so we can decide if -d 0 was used. */