This source file includes following definitions.
- is_pcmk__is_user_in_group
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <crm/common/unittest_internal.h>
13 #include <crm/common/acl.h>
14
15 #include "../../crmcommon_private.h"
16 #include "mock_private.h"
17
18 static void
19 is_pcmk__is_user_in_group(void **state)
20 {
21 pcmk__mock_grent = true;
22
23
24 assert_false(pcmk__is_user_in_group(NULL, "grp0"));
25
26 assert_false(pcmk__is_user_in_group("user0", NULL));
27
28 assert_false(pcmk__is_user_in_group("user0", "nonexistent_group"));
29
30 assert_true(pcmk__is_user_in_group("user0", "grp0"));
31
32 assert_false(pcmk__is_user_in_group("user2", "grp0"));
33
34 pcmk__mock_grent = false;
35 }
36
37 PCMK__UNIT_TEST(NULL, NULL,
38 cmocka_unit_test(is_pcmk__is_user_in_group))