1
|
|
|
import tests.any_test_help |
2
|
|
|
from oval_graph.oval_node import OvalNode |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
def test_create_node_dict_for_JsTree_0(): |
6
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_0.json' |
7
|
|
|
tree = tests.any_test_help.get_simple_tree() |
8
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree(tree, src) |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
def test_create_node_dict_for_JsTree_1(): |
12
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_1.json' |
13
|
|
|
|
14
|
|
|
tree = OvalNode( |
15
|
|
|
node_id=1, |
16
|
|
|
node_type='operator', |
17
|
|
|
value='and', |
18
|
|
|
children=[ |
19
|
|
|
OvalNode( |
20
|
|
|
node_id=2, |
21
|
|
|
node_type='value', |
22
|
|
|
value='true', |
23
|
|
|
) |
24
|
|
|
] |
25
|
|
|
) |
26
|
|
|
|
27
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree(tree, src) |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
def test_create_node_dict_for_JsTree_2(): |
31
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_2.json' |
32
|
|
|
|
33
|
|
|
tree = OvalNode( |
34
|
|
|
node_id=1, |
35
|
|
|
node_type='operator', |
36
|
|
|
value='and', |
37
|
|
|
children=[ |
38
|
|
|
OvalNode( |
39
|
|
|
node_id=2, |
40
|
|
|
node_type='value', |
41
|
|
|
value='noteval', |
42
|
|
|
) |
43
|
|
|
] |
44
|
|
|
) |
45
|
|
|
|
46
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree(tree, src) |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
def test_create_node_dict_for_JsTree_3(): |
50
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_3.json' |
51
|
|
|
|
52
|
|
|
tree = OvalNode( |
53
|
|
|
node_id=1, |
54
|
|
|
node_type='value', |
55
|
|
|
value='false', |
56
|
|
|
) |
57
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree(tree, src) |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
def test_create_node_dict_for_JsTree_4(): |
61
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_4.json' |
62
|
|
|
|
63
|
|
|
tree = OvalNode( |
64
|
|
|
node_id=1, |
65
|
|
|
node_type='value', |
66
|
|
|
value='true', |
67
|
|
|
) |
68
|
|
|
|
69
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree(tree, src) |
70
|
|
|
|
71
|
|
|
|
72
|
|
|
def test_create_node_dict_for_JsTree_5(): |
73
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_5.json' |
74
|
|
|
|
75
|
|
|
tree = OvalNode( |
76
|
|
|
node_id=1, |
77
|
|
|
node_type='value', |
78
|
|
|
value='error', |
79
|
|
|
) |
80
|
|
|
|
81
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree(tree, src) |
82
|
|
|
|
83
|
|
|
|
84
|
|
|
def test_create_node_with_negation_dict_for_JsTree(): |
85
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_negated_0.json' |
86
|
|
|
|
87
|
|
|
tree = OvalNode( |
88
|
|
|
node_id=1, |
89
|
|
|
node_type='operator', |
90
|
|
|
value='and', |
91
|
|
|
negation=True, |
92
|
|
|
children=[ |
93
|
|
|
OvalNode( |
94
|
|
|
node_id=2, |
95
|
|
|
node_type='value', |
96
|
|
|
value='false', |
97
|
|
|
) |
98
|
|
|
] |
99
|
|
|
) |
100
|
|
|
|
101
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree(tree, src) |
102
|
|
|
|
103
|
|
|
|
104
|
|
|
def test_create_node_with_negation_dict_for_JsTree1(): |
105
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_negated_1.json' |
106
|
|
|
|
107
|
|
|
tree = OvalNode( |
108
|
|
|
node_id=1, |
109
|
|
|
node_type='operator', |
110
|
|
|
value='and', |
111
|
|
|
negation=True, |
112
|
|
|
children=[ |
113
|
|
|
OvalNode( |
114
|
|
|
node_id=2, |
115
|
|
|
node_type='value', |
116
|
|
|
value='true', |
117
|
|
|
) |
118
|
|
|
] |
119
|
|
|
) |
120
|
|
|
|
121
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree(tree, src) |
122
|
|
|
|
123
|
|
|
|
124
|
|
|
def test_create_node_with_negation_dict_for_JsTree2(): |
125
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_negated_2.json' |
126
|
|
|
|
127
|
|
|
tree = OvalNode( |
128
|
|
|
node_id=1, |
129
|
|
|
node_type='operator', |
130
|
|
|
value='and', |
131
|
|
|
children=[ |
132
|
|
|
OvalNode( |
133
|
|
|
node_id=2, |
134
|
|
|
node_type='value', |
135
|
|
|
value='true', |
136
|
|
|
negation=True, |
137
|
|
|
) |
138
|
|
|
] |
139
|
|
|
) |
140
|
|
|
|
141
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree( |
142
|
|
|
tree.children[0], src) |
143
|
|
|
|
144
|
|
|
|
145
|
|
|
def test_create_node_with_negation_dict_for_JsTree3(): |
146
|
|
|
src = 'test_data/test_JsTree_data/JsTree_data_negated_3.json' |
147
|
|
|
|
148
|
|
|
tree = OvalNode( |
149
|
|
|
node_id=1, |
150
|
|
|
node_type='operator', |
151
|
|
|
value='and', |
152
|
|
|
children=[ |
153
|
|
|
OvalNode( |
154
|
|
|
node_id=2, |
155
|
|
|
node_type='value', |
156
|
|
|
value='false', |
157
|
|
|
negation=True, |
158
|
|
|
) |
159
|
|
|
] |
160
|
|
|
) |
161
|
|
|
|
162
|
|
|
tests.any_test_help.any_test_create_node_dict_for_JsTree( |
163
|
|
|
tree.children[0], src) |
164
|
|
|
|
165
|
|
|
|
166
|
|
|
def test_transformation_tree_to_Json_for_JsTree_0(): |
167
|
|
|
test_data_src = 'test_data/JsTree_json0.json' |
168
|
|
|
src = 'test_data/ssg-fedora-ds-arf.xml' |
169
|
|
|
rule_id = 'xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny' |
170
|
|
|
|
171
|
|
|
tests.any_test_help.any_test_transformation_tree_to_Json_for_JsTree( |
172
|
|
|
src, test_data_src, rule_id) |
173
|
|
|
|
174
|
|
|
|
175
|
|
|
def test_transformation_tree_to_Json_for_JsTree_with_duplicated_test(): |
176
|
|
|
test_data_src = 'test_data/JsTree_json1.json' |
177
|
|
|
src = 'test_data/ssg-fedora-ds-arf.xml' |
178
|
|
|
rule_id = 'xccdf_org.ssgproject.content_rule_disable_host_auth' |
179
|
|
|
|
180
|
|
|
tests.any_test_help.any_test_transformation_tree_to_Json_for_JsTree( |
181
|
|
|
src, test_data_src, rule_id) |
182
|
|
|
|