1 from unittest
.mock
import Mock
4 from salmon
import mail
, utils
5 from salmon
.routing
import Router
7 from .setup_env
import SalmonTestCase
9 sample_message
= """From: someone@localhost
17 return mail
.MailRequest("localhost", "someone@localhost", "someone@localhost", sample_message
)
20 class HandlerTestCase(SalmonTestCase
):
24 for key
in Router
.HANDLERS
.keys():
26 Router
.HANDLERS
.clear()
29 def test_log_handler(self
):
30 import salmon
.handlers
.log
# noqa
31 Router
.deliver(create_message())
33 def test_queue_handler(self
):
34 import salmon
.handlers
.queue
# noqa
35 Router
.deliver(create_message())
37 def test_forward(self
):
38 utils
.import_settings(False)
40 import salmon
.handlers
.forward
# noqa
41 salmon
.handlers
.forward
.settings
.relay
= Mock()
42 Router
.deliver(create_message())
44 self
.assertEqual(salmon
.handlers
.forward
.settings
.relay
.deliver
.call_count
, 1)