Exemple #1
0
    def test_remove_header_rule_ham(self):
        line = "ham Test"
        ruleset = oa.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))
Exemple #2
0
    def test_add_header_rule_ham(self):
        line = "ham Test my value"
        ruleset = oa.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"))
Exemple #3
0
    def test_remove_header_rule_invalid(self):
        line = "bam Test"
        ruleset = oa.rules.ruleset.RuleSet(self.mock_ctxt)

        with self.assertRaises(oa.errors.InvalidRule):
            ruleset._add_header_rule(line, remove=True)