Esempio n. 1
0
    def test_interpolate_not_spam(self):
        mock_msg = MagicMock(rules_checked={}, interpolate_data={}, score=4)
        mock_rule = MagicMock()
        ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt)
        ruleset.checked = {"TEST_RULE": mock_rule}

        result = ruleset._interpolate("test %(YESNO)s test", mock_msg)
        self.assertEqual(result, "test No test")
Esempio n. 2
0
    def test_interpolate_not_spam(self):
        mock_msg = MagicMock(rules_checked={}, interpolate_data={}, score=4)
        mock_rule = MagicMock()
        ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt)
        ruleset.checked = {"TEST_RULE": mock_rule}

        result = ruleset._interpolate("test %(YESNO)s test", mock_msg)
        self.assertEqual(result, "test No test")
Esempio n. 3
0
    def test_interpolate_data_available(self):
        mock_msg = MagicMock(rules_checked={}, interpolate_data={"REQD": "5.0"},
                             score=4)
        mock_rule = MagicMock()
        ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt)
        ruleset.checked = {"TEST_RULE": mock_rule}

        result = ruleset._interpolate("test %(REQD)s test", mock_msg)
        self.assertEqual(result, "test 5.0 test")
Esempio n. 4
0
    def test_interpolate_data_available(self):
        mock_msg = MagicMock(rules_checked={},
                             interpolate_data={"REQD": "5.0"},
                             score=4)
        mock_rule = MagicMock()
        ruleset = pad.rules.ruleset.RuleSet(self.mock_ctxt)
        ruleset.checked = {"TEST_RULE": mock_rule}

        result = ruleset._interpolate("test %(REQD)s test", mock_msg)
        self.assertEqual(result, "test 5.0 test")