Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 7f306e0

Browse files
author
Tom Galloway
committed
Init test for smtp notifications.
1 parent 9e34976 commit 7f306e0

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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

Comments
 (0)