示例#1
0
    def test_init_with_rules_no_error(self):
        """Test the __init__() with a rules path."""
        path1 = 'path/to/rules'
        base = bre.BaseRulesEngine(rules_file_path=path1)
        self.assertEquals(path1, base.full_rules_path)

        path2 = '  path/to/rules   '
        base2 = bre.BaseRulesEngine(rules_file_path=path2)
        self.assertEqual(path2.strip(), base2.full_rules_path)
示例#2
0
 def test_build_rule_book_not_implemented_error(self):
     """Test that invoking build_rule_book() raises NotImplementedError."""
     base = bre.BaseRulesEngine('foo')
     with self.assertRaises(NotImplementedError):
         base.build_rule_book({})
示例#3
0
 def test_init_with_no_rules_raises_error(self):
     """Test __init__() with no rules raises InvalidRuleDefinitionError."""
     with self.assertRaises(audit_errors.InvalidRuleDefinitionError):
         bre.BaseRulesEngine()