Exemplo n.º 1
0
class TransportTestCase(SMTPTestCase):
    pipeline = None
    
    def setUp(self):
        self.transport = SMTPTransport(dict(port=self.port, pipeline=self.pipeline))
        self.transport.startup()
        self.msg = self.message
    
    def tearDown(self):
        self.transport.shutdown()
        self.transport = None
        self.msg = None
    
    @property
    def message(self):
        return Message('*****@*****.**', '*****@*****.**', 'Test subject.', plain="Test body.")
Exemplo n.º 2
0
 def test_basic_config(self):
     transport = SMTPTransport(dict(port=self.port, timeout="10", tls=False, pipeline="10"))
     
     self.assertEqual(transport.sent, 0)
     self.assertEqual(transport.host, '127.0.0.1')
     self.assertEqual(transport.port, self.port)
     self.assertEqual(transport.timeout, 10)
     self.assertEqual(transport.pipeline, 10)
     self.assertEqual(transport.debug, False)
     
     self.assertEqual(transport.connected, False)
Exemplo n.º 3
0
 def test_authentication(self):
     transport = SMTPTransport(dict(port=self.port, username='******', password='******'))
     
     transport.startup()
     self.assertTrue(transport.connected)
     
     transport.shutdown()
     self.assertFalse(transport.connected)
Exemplo n.º 4
0
 def test_startup_shutdown(self):
     transport = SMTPTransport(dict(port=self.port))
     
     transport.startup()
     self.assertTrue(transport.connected)
     
     transport.shutdown()
     self.assertFalse(transport.connected)
Exemplo n.º 5
0
 def setUp(self):
     self.transport = SMTPTransport(dict(port=self.port, pipeline=self.pipeline))
     self.transport.startup()
     self.msg = self.message
Exemplo n.º 6
0
 def test_bad_tls(self):
     transport = SMTPTransport(dict(port=self.port, tls='required'))
     self.assertRaises(TransportException, transport.startup)