| 1 |  |  | import tests.any_test_help | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | import graph.oval_graph | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | import os | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | import py | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | import pytest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | import json | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | def test_create_node_dict_for_sigmaJs_0(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |     out = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |         'color': '#ff0000', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |         'id': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |         'label': 'and', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |         'size': 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |         'text': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |         'url': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |         'title': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |         'x': 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |         'y': 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     Tree = tests.any_test_help.get_simple_tree() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     tests.any_test_help.any_test_create_node_dict_for_sigmaJs(Tree, out) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | def test_create_node_dict_for_sigmaJs_1(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     out = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         'color': '#00ff00', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         'id': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         'label': 'and', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         'size': 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         'text': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         'url': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         'title': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         'x': 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         'y': 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     Tree = graph.oval_graph.OvalNode(1, 'operator', 'and', False, [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         graph.oval_graph.OvalNode(2, 'value', "true", False) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     tests.any_test_help.any_test_create_node_dict_for_sigmaJs(Tree, out) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | def test_create_node_dict_for_sigmaJs_2(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     out = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         'color': '#000000', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         'id': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         'label': 'and', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         'size': 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         'text': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         'url': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         'title': '1 and', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         'x': 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         'y': 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     Tree = graph.oval_graph.OvalNode(1, 'operator', 'and', False, [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         graph.oval_graph.OvalNode(2, 'value', "noteval", False) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     tests.any_test_help.any_test_create_node_dict_for_sigmaJs(Tree, out) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | def test_create_node_dict_for_sigmaJs_3(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     out = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         'color': '#ff0000', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         'id': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         'label': '1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         'size': 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         'text': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         'url': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         'title': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         'x': 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         'y': 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     Tree = graph.oval_graph.OvalNode(1, 'value', 'false', False) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     tests.any_test_help.any_test_create_node_dict_for_sigmaJs(Tree, out) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | def test_create_node_dict_for_sigmaJs_4(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     out = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         'color': '#00ff00', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         'id': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         'label': '1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         'size': 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         'text': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         'url': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         'title': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         'x': 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         'y': 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     Tree = graph.oval_graph.OvalNode(1, 'value', 'true', False) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     tests.any_test_help.any_test_create_node_dict_for_sigmaJs(Tree, out) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | def test_create_node_dict_for_sigmaJs_5(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |     out = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         'color': '#000000', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |         'id': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |         'label': '1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         'size': 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         'text': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         'url': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         'title': '1 error', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         'x': 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         'y': 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |     Tree = graph.oval_graph.OvalNode(1, 'value', 'error', False) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     tests.any_test_help.any_test_create_node_dict_for_sigmaJs(Tree, out) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | def test_create_edge_dict_for_sigmaJs(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     out = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         'id': 'random_ID', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |         'source': 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |         'target': 2, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |         'color': '#000000' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     target_node = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         'color': '#000000', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         'id': 2, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         'label': 'error', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |         'size': 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         'text': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |         'url': 'null', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |         'title': '1 error', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |         'x': 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         'y': 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     assert tests.any_test_help.get_simple_tree()._create_edge( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |         1, 2, target_node)['source'] == out['source'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     assert tests.any_test_help.get_simple_tree()._create_edge( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         1, 2, target_node)['target'] == out['target'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |     assert tests.any_test_help.get_simple_tree()._create_edge( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |         1, 2, target_node)['color'] == out['color'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | def test_create_array_of_ids_form_tree(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |     array = tests.any_test_help.get_simple_tree().create_list_of_id() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     assert array == [1, 2, 3, 4, 5, 6] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | def test_parsing_full_can_XML_and_evaluate(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |     src = 'test_data/ssg-fedora-ds-arf.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |     rule_id = 'xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     result = 'false' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |     tests.any_test_help.any_test_parsing_and_evaluate_scan_rule( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         src, rule_id, result) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | def test_parsing_and_evaluate_scan_with_extend_def(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |     src = 'test_data/ssg-fedora-ds-arf-scan-with-extend-definitions.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |     rule_id = 'xccdf_org.ssgproject.content_rule_sysctl_net_ipv6_conf_all_disable_ipv6' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |     result = 'false' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     tests.any_test_help.any_test_parsing_and_evaluate_scan_rule( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |         src, rule_id, result) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | def test_parsing_and_evaluate_scan_with_pasing_rule(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     src = 'test_data/ssg-fedora-ds-arf-passing-scan.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |     rule_id = 'xccdf_org.ssgproject.content_rule_service_debug-shell_disabled' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |     result = 'true' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |     tests.any_test_help.any_test_parsing_and_evaluate_scan_rule( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |         src, rule_id, result) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | def test_parsing_and_evaluate_scan_with_fail_rule(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |     src = 'test_data/ssg-fedora-ds-arf-scan-fail.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     rule_id = 'xccdf_org.ssgproject.content_rule_mount_option_dev_shm_noexec' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |     result = 'false' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |     tests.any_test_help.any_test_parsing_and_evaluate_scan_rule( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |         src, rule_id, result) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | def test_parsing_and_evaluate_scan_with_rule_with_XOR(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     src = 'test_data/ssg-fedora-ds-arf-scan-with-xor.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |     rule_id = 'xccdf_org.ssgproject.content_rule_mount_option_nosuid_removable_partitions' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     result = 'true' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |     tests.any_test_help.any_test_parsing_and_evaluate_scan_rule( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         src, rule_id, result) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | def test_parsing_and_evaluate_scan_with_11_rules(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |     src = 'test_data/ssg-fedora-ds-arf-scan-with-11-rules.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     rule_id = 'xccdf_org.ssgproject.content_rule_mount_option_tmp_nosuid' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |     result = 'true' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |     tests.any_test_help.any_test_parsing_and_evaluate_scan_rule( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |         src, rule_id, result) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | def test_transformation_tree_to_Json_for_SigmaJs_0(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     test_data_src = 'test_data/sigmaJs_json0.json' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     src = 'data/ssg-fedora-ds-arf.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     rule_id = 'xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     tests.any_test_help.any_test_transformation_tree_to_Json_for_SigmaJs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |         src, test_data_src, rule_id) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | def test_transformation_tree_to_Json_for_SigmaJs_with_duplicated_test(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     test_data_src = 'test_data/sigmaJs_json1.json' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |     src = 'data/ssg-fedora-ds-arf.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     rule_id = 'xccdf_org.ssgproject.content_rule_disable_host_auth' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     tests.any_test_help.any_test_transformation_tree_to_Json_for_SigmaJs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |         src, test_data_src, rule_id) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |  | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 221 |  | View Code Duplication | def test_get_def_id_by_rule_id(): | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |     src = 'test_data/ssg-fedora-ds-arf.xml' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |     _dir = os.path.dirname(os.path.realpath(__file__)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |     FIXTURE_DIR = py.path.local(_dir) / src | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     parser = graph.xml_parser.xml_parser(str(FIXTURE_DIR)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     with pytest.raises(ValueError) as e: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |         parser.get_def_id_by_rule_id('hello') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |     assert str( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |         e.value) == 'err- 404 rule not found!' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 234 |  | View Code Duplication | def test_use_bat_report_file(): | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |     src = ('test_data/xccdf_org.ssgproject.content_rule_sssd_' + | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |            'ssh_known_hosts_timeout-comment.fail.sh-xccdf_or' + | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |            'g.ssgproject.content_profile_ospp-results-initial.xml') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |     _dir = os.path.dirname(os.path.realpath(__file__)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |     FIXTURE_DIR = py.path.local(_dir) / src | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |     with pytest.raises(ValueError) as e: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |         parser = graph.xml_parser.xml_parser(str(FIXTURE_DIR)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |         assert str( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |             e.value) == 'err- This is not arf report file.' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 247 |  |  | def test_get_rule_dict(): | 
            
                                                        
            
                                    
            
            
                | 248 |  |  |     src = 'test_data/ssg-fedora-ds-arf.xml' | 
            
                                                        
            
                                    
            
            
                | 249 |  |  |     _dir = os.path.dirname(os.path.realpath(__file__)) | 
            
                                                        
            
                                    
            
            
                | 250 |  |  |     FIXTURE_DIR = py.path.local(_dir) / src | 
            
                                                        
            
                                    
            
            
                | 251 |  |  |     parser = graph.xml_parser.xml_parser(str(FIXTURE_DIR)) | 
            
                                                        
            
                                    
            
            
                | 252 |  |  |     dict = parser.get_rule_dict( | 
            
                                                        
            
                                    
            
            
                | 253 |  |  |         'xccdf_org.ssgproject.content_rule_dconf_gnome_session_idle_user_locks') | 
            
                                                        
            
                                    
            
            
                | 254 |  |  |     src = 'test_data/rule_dict.json' | 
            
                                                        
            
                                    
            
            
                | 255 |  |  |     _dir = os.path.dirname(os.path.realpath(__file__)) | 
            
                                                        
            
                                    
            
            
                | 256 |  |  |     FIXTURE_DIR = py.path.local(_dir) / src | 
            
                                                        
            
                                    
            
            
                | 257 |  |  |     with open(str(FIXTURE_DIR), 'r') as f: | 
            
                                                        
            
                                    
            
            
                | 258 |  |  |         data = json.load(f) | 
            
                                                        
            
                                    
            
            
                | 259 |  |  |     assert data == dict | 
            
                                                        
            
                                    
            
            
                | 260 |  |  |  |