def test_post_parsing(self): mock_rule = Mock() ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt) ruleset.checked = {"TEST_RULE": mock_rule} ruleset.post_parsing() mock_rule.postparsing.assert_called_with(ruleset)
def test_post_parsing_invalid_rule(self): mock_rule = Mock(**{"postparsing.side_effect": pad.errors.InvalidRule("TEST_RULE")}) self.mock_ctxt.paranoid = False ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt) ruleset.checked = {"TEST_RULE": mock_rule} ruleset.post_parsing() mock_rule.postparsing.assert_called_with(ruleset) self.assertEqual(ruleset.checked, {})
def test_post_parsing_invalid_rule(self): mock_rule = Mock( **{"postparsing.side_effect": pad.errors.InvalidRule("TEST_RULE")}) self.mock_ctxt.paranoid = False ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt) ruleset.checked = {"TEST_RULE": mock_rule} ruleset.post_parsing() mock_rule.postparsing.assert_called_with(ruleset) self.assertEqual(ruleset.checked, {})