def test_delivered(self): clear_queue() queue().push("To: gooduser@localhost\nFrom: tester@localhost\n\nHi\n") assert delivered("gooduser@localhost"), "Test message not delivered." assert not delivered("baduser@localhost") assert_in_state('tests.handlers.simple_fsm_mod', 'gooduser@localhost', 'tester@localhost', 'START')
def test_delivered(): clear_queue() queue().push("To: gooduser@localhost\nFrom: tester@localhost\n\nHi\n") assert delivered("gooduser@localhost"), "Test message not delivered." assert not delivered("baduser@localhost") assert_in_state('salmon_tests.handlers.simple_fsm_mod', 'gooduser@localhost', 'tester@localhost', 'START')
def test_ConfirmationEngine_send(smtp_mock): smtp_mock.return_value = Mock() Queue("run/queue").clear() engine.clear() list_name = "testing" action = "subscribing to" host = "localhost" message = mail.MailRequest("fakepeer", "somedude@localhost", "testing-subscribe@localhost", "Fake body.") engine.send(relay(port=8899), "testing", message, "confirmation.msg", locals()) assert smtp_mock.return_value.sendmail.called assert smtp_mock.return_value.quit.called assert delivered("somedude", to_queue=engine.pending) return smtp_mock.return_value.sendmail.call_args[0][2]
def test_ConfirmationEngine_send(self, smtp_mock): smtp_mock.return_value = Mock() Queue('run/queue').clear() self.engine.clear() list_name = 'testing' action = 'subscribing to' host = 'localhost' message = mail.MailRequest('fakepeer', 'somedude@localhost', 'testing-subscribe@localhost', 'Fake body.') self.engine.send(relay(port=0), 'testing', message, 'confirmation.msg', locals()) self.assertEqual(smtp_mock.return_value.sendmail.call_count, 1) self.assertEqual(smtp_mock.return_value.quit.call_count, 1) assert delivered('somedude', to_queue=self.engine.pending) return smtp_mock.return_value.sendmail.call_args[0][2]
def test_ConfirmationEngine_send(smtp_mock): smtp_mock.return_value = Mock() Queue('run/queue').clear() engine.clear() list_name = 'testing' action = 'subscribing to' host = 'localhost' message = mail.MailRequest('fakepeer', 'somedude@localhost', 'testing-subscribe@localhost', 'Fake body.') engine.send(relay(port=8899), 'testing', message, 'confirmation.msg', locals()) assert smtp_mock.return_value.sendmail.called assert smtp_mock.return_value.quit.called assert delivered('somedude', to_queue=engine.pending) return smtp_mock.return_value.sendmail.call_args[0][2]
def test_RouterConversation(): client = RouterConversation('tester@localhost', 'Test router conversations.') client.begin() client.say('testlist@localhost', 'This is a test') delivered('testlist@localhost'), "Test message not delivered."