pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
lib
common
tests
acl
pcmk__is_user_in_group_test.c
Go to the documentation of this file.
1
/*
2
* Copyright 2020-2022 the Pacemaker project contributors
3
*
4
* The version control history for this file may have further details.
5
*
6
* This source code is licensed under the GNU General Public License version 2
7
* or later (GPLv2+) WITHOUT ANY WARRANTY.
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
// null user
24
assert_false(
pcmk__is_user_in_group
(NULL,
"grp0"
));
25
// null group
26
assert_false(
pcmk__is_user_in_group
(
"user0"
, NULL));
27
// nonexistent group
28
assert_false(
pcmk__is_user_in_group
(
"user0"
,
"nonexistent_group"
));
29
// user is in group
30
assert_true(
pcmk__is_user_in_group
(
"user0"
,
"grp0"
));
31
// user is not in group
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))
mock_private.h
pcmk__mock_grent
bool pcmk__mock_grent
Definition:
mock.c:189
pcmk__is_user_in_group
G_GNUC_INTERNAL bool pcmk__is_user_in_group(const char *user, const char *group)
Definition:
utils.c:54
PCMK__UNIT_TEST
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
crm_internal.h
acl.h
Low-level API for XML Access Control Lists (ACLs)
unittest_internal.h
Generated on Tue Dec 19 2023 17:32:56 for pacemaker by
1.8.14