diff --git a/rattail/tests/filemon/test_actions.py b/rattail/tests/filemon/test_actions.py index 823db8fa3acb4a7fba5f7600d946fcf056d86925..905485d3ca4363cd9cec63811bce7ec276f8cdd1 100644 --- a/rattail/tests/filemon/test_actions.py +++ b/rattail/tests/filemon/test_actions.py @@ -10,7 +10,7 @@ from unittest import TestCase from mock import Mock, patch, call from fixture import TempIO -from rattail.config import make_config +from rattail.config import make_config, RattailConfig from rattail.filemon import actions from rattail.filemon.config import Profile, ProfileAction @@ -101,6 +101,7 @@ class TestInvokeAction(TestCase): def setUp(self): self.action = ProfileAction() + self.action.config = RattailConfig() self.action.action = Mock(return_value=None) self.action.retry_attempts = 6 self.tmp = TempIO() @@ -130,7 +131,8 @@ class TestInvokeAction(TestCase): def test_action_which_fails_is_only_attempted_the_specified_number_of_times(self): self.action.action.side_effect = RuntimeError # Last attempt will not handle the exception; assert that as well. - self.assertRaises(RuntimeError, actions.invoke_action, self.action, self.file) + with patch('rattail.filemon.actions.send_email') as send_email: + self.assertRaises(RuntimeError, actions.invoke_action, self.action, self.file) self.assertEqual(self.action.action.call_count, 6) def test_action_which_fails_then_succeeds_stops_retrying(self):