Ejemplo n.º 1
0
 def test_get_audit_rule_info(self, mock_system_info, mock_load_persist,
                              mock_type):
     rule_type = 'System Call Rule'
     name = 'a always,exit -F arch=b32 -F arch=b64 -S init_module,' \
            'delete_module,finit_module -F key=abc99'
     mock_type.return_value = rule_type
     audit_info = {
         'rule': 'a always,exit -F arch=b32 -F '
         'arch=b64 -S init_module,'
         'delete_module,finit_module -F key=abc99',
         'type': 'System Call Rule'
     }
     mock_load_persist.return_value = {}
     expected_out = {
         'type':
         'System Call Rule',
         'rule':
         'a always,exit -F arch=b32 -F'
         ' arch=b64 -S init_module,delete_module,'
         'finit_module -F key=abc99'
     }
     mock_system_info.return_value = {}
     rulemodel = RuleModel()
     actualout = rulemodel.get_audit_rule_info(name)
     mock_system_info.assert_called_with(audit_info, name)
     self.assertEquals(actualout, expected_out)
Ejemplo n.º 2
0
 def test_get_audit_rule_info(self, mock_system_info,
                              mock_load_persist, mock_type):
     rule_type = 'System Call Rule'
     name = 'a always,exit -F arch=b32 -F arch=b64 -S init_module,' \
            'delete_module,finit_module -F key=abc99'
     mock_type.return_value = rule_type
     audit_info = {'rule': 'a always,exit -F arch=b32 -F '
                           'arch=b64 -S init_module,'
                           'delete_module,finit_module -F key=abc99',
                   'type': 'System Call Rule'}
     mock_load_persist.return_value = {}
     expected_out = {'type': 'System Call Rule',
                     'rule': 'a always,exit -F arch=b32 -F'
                             ' arch=b64 -S init_module,delete_module,'
                             'finit_module -F key=abc99'}
     mock_system_info.return_value = {}
     rulemodel = RuleModel()
     actualout = rulemodel.get_audit_rule_info(name)
     mock_system_info.assert_called_with(audit_info, name)
     self.assertEquals(actualout, expected_out)