|
| 1 | +from twisted.trial import unittest |
| 2 | +from twisted.python import log |
| 3 | +from mock import MagicMock |
| 4 | + |
| 5 | +from market.smtpnotification import SMTPNotification |
| 6 | + |
| 7 | +class MarketSMTPTest(unittest.TestCase): |
| 8 | + |
| 9 | + def setUp(self): |
| 10 | + self.catcher = [] |
| 11 | + observer = self.catcher.append |
| 12 | + log.addObserver(observer) |
| 13 | + self.addCleanup(log.removeObserver, observer) |
| 14 | + self.db = MagicMock() |
| 15 | + |
| 16 | + def test_MarketSmtp_settings_success(self): |
| 17 | + '''SMTP Notification settings correctly set.''' |
| 18 | + self.db.settings.get.return_value = ['0', '1', '2', '3', '4', '5', '6', |
| 19 | + '7', '8', '9', '10', '11', '12', |
| 20 | + '13', '14', 'test_server', |
| 21 | + 'test_sender', 'test_recipient', |
| 22 | + 'test_username', 'test_password'] |
| 23 | + s = SMTPNotification(self.db) |
| 24 | + self.assertEqual('test_server', s.server) |
| 25 | + self.assertEqual('test_sender', s.sender) |
| 26 | + self.assertEqual('test_recipient', s.recipient) |
| 27 | + self.assertEqual('test_username', s.username) |
| 28 | + self.assertEqual('test_password', s.password) |
0 commit comments