This source file includes following definitions.
- is_xml_acl_denied_without_node
- is_xml_acl_denied_with_node
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
17 static void
18 is_xml_acl_denied_without_node(void **state)
19 {
20 xmlNode *test_xml = pcmk__xe_create(NULL, "test_xml");
21 assert_false(xml_acl_denied(test_xml));
22
23 test_xml->doc->_private = NULL;
24 assert_false(xml_acl_denied(test_xml));
25
26 test_xml->doc = NULL;
27 assert_false(xml_acl_denied(test_xml));
28
29 test_xml = NULL;
30 assert_false(xml_acl_denied(test_xml));
31 }
32
33 static void
34 is_xml_acl_denied_with_node(void **state)
35 {
36 xml_doc_private_t *docpriv;
37
38 xmlNode *test_xml = pcmk__xe_create(NULL, "test_xml");
39
40
41 test_xml->doc->_private = pcmk__assert_alloc(1, sizeof(xml_doc_private_t));
42
43 assert_false(xml_acl_denied(test_xml));
44
45
46 docpriv = test_xml->doc->_private;
47
48
49 docpriv->flags |= pcmk__xf_acl_enabled;
50
51 assert_false(xml_acl_denied(test_xml));
52
53
54 docpriv->flags |= pcmk__xf_acl_denied;
55
56 assert_true(xml_acl_denied(test_xml));
57 }
58
59 PCMK__UNIT_TEST(pcmk__xml_test_setup_group, NULL,
60 cmocka_unit_test(is_xml_acl_denied_without_node),
61 cmocka_unit_test(is_xml_acl_denied_with_node))