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")
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")