Code

Ticket #15917: tests.py

File tests.py, 896 bytes (added by albenik, 3 years ago)

Tests demontrates incorrect behaviour

Line 
1import logging
2from logging.handlers import SMTPHandler
3from django.test import TestCase
4
5class DjangoCoreTests(TestCase):
6    def setUp(self):
7        self.log = logging.getLogger('test.logger')
8
9
10    def test_correct_host(self):
11        for h in self.log.handlers:
12            if isinstance(h, SMTPHandler):
13                self.assertEquals(h.mailhost, "mailhost.test")
14
15
16    def test_correct_port(self):
17        for h in self.log.handlers:
18            if isinstance(h, SMTPHandler):
19                self.assertEquals(h.mailport, 321)
20
21
22    def test_correct_username(self):
23        for h in self.log.handlers:
24            if isinstance(h, SMTPHandler):
25                self.assertEquals(h.username, "testuser1")
26
27
28    def test_correct_password(self):
29        for h in self.log.handlers:
30            if isinstance(h, SMTPHandler):
31                self.assertEquals(h.password, "testpassword1")