def test_remove_header_rule_ham(self): line = "ham Test" ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt) ruleset._add_header_rule(line, remove=True) result = ruleset.header_mod["ham"][0] self.assertEqual(result, (True, "X-Spam-Test", None))
def test_add_header_rule_ham(self): line = "ham Test my value" ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt) ruleset._add_header_rule(line, remove=False) result = ruleset.header_mod["ham"][0] self.assertEqual(result, (False, "X-Spam-Test", "my value"))
def test_remove_header_rule_invalid(self): line = "bam Test" ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt) with self.assertRaises(pad.errors.InvalidRule): ruleset._add_header_rule(line, remove=True)