当前位置: 首页>>代码示例>>Python>>正文


Python client.Client类代码示例

本文整理汇总了Python中slimta.smtp.client.Client的典型用法代码示例。如果您正苦于以下问题:Python Client类的具体用法?Python Client怎么用?Python Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_mailfrom_size

 def test_mailfrom_size(self):
     self.sock.sendall(b'MAIL FROM:<test> SIZE=10\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 2.0.0 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     client.extensions.add('SIZE', 100)
     client.mailfrom('test', data_size=10)
开发者ID:you4you4,项目名称:python-slimta,代码行数:7,代码来源:test_slimta_smtp_client.py

示例2: test_get_banner

 def test_get_banner(self):
     self.sock.recv(IsA(int)).AndReturn(b'220 Go\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.get_banner()
     self.assertEqual('220', reply.code)
     self.assertEqual('Go', reply.message)
     self.assertEqual(b'[BANNER]', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_client.py

示例3: test_get_reply

 def test_get_reply(self):
     self.sock.recv(IsA(int)).AndReturn(b'421 Test\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.get_reply(b'[TEST]')
     self.assertEqual('421', reply.code)
     self.assertEqual('4.0.0 Test', reply.message)
     self.assertEqual(b'[TEST]', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_client.py

示例4: test_starttls_noencrypt

 def test_starttls_noencrypt(self):
     self.sock.sendall(b"STARTTLS\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"420 Nope\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.starttls({})
     self.assertEqual("420", reply.code)
     self.assertEqual("4.0.0 Nope", reply.message)
     self.assertEqual(b"STARTTLS", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例5: test_custom_command

 def test_custom_command(self):
     self.sock.sendall(b'cmd arg\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.custom_command(b'cmd', b'arg')
     self.assertEqual('250', reply.code)
     self.assertEqual('2.0.0 Ok', reply.message)
     self.assertEqual(b'CMD', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例6: test_send_data

 def test_send_data(self):
     self.sock.sendall(b'One\r\nTwo\r\n..Three\r\n.\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 2.0.0 Done\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.send_data(b'One\r\nTwo\r\n.Three')
     self.assertEqual('250', reply.code)
     self.assertEqual('2.0.0 Done', reply.message)
     self.assertEqual(b'[SEND_DATA]', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例7: test_rcptto

 def test_rcptto(self):
     self.sock.sendall(b"RCPT TO:<test>\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"250 2.0.0 Ok\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.rcptto("test")
     self.assertEqual("250", reply.code)
     self.assertEqual("2.0.0 Ok", reply.message)
     self.assertEqual(b"RCPT", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例8: test_mailfrom

 def test_mailfrom(self):
     self.sock.sendall(b"MAIL FROM:<test>\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"250 2.0.0 Ok\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.mailfrom("test")
     self.assertEqual("250", reply.code)
     self.assertEqual("2.0.0 Ok", reply.message)
     self.assertEqual(b"MAIL", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例9: test_auth_force_mechanism

 def test_auth_force_mechanism(self):
     self.sock.sendall(b'AUTH PLAIN AHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'535 Nope!\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.auth('[email protected]', 'asdf', mechanism=b'PLAIN')
     self.assertEqual('535', reply.code)
     self.assertEqual('5.0.0 Nope!', reply.message)
     self.assertEqual(b'AUTH', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例10: test_starttls_noencrypt

 def test_starttls_noencrypt(self):
     self.sock.sendall('STARTTLS\r\n')
     self.sock.recv(IsA(int)).AndReturn('420 Nope\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.starttls({})
     assert_equal('420', reply.code)
     assert_equal('4.0.0 Nope', reply.message)
     assert_equal('STARTTLS', reply.command)
开发者ID:drewlander,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例11: test_quit

 def test_quit(self):
     self.sock.sendall('QUIT\r\n')
     self.sock.recv(IsA(int)).AndReturn('221 Bye\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.quit()
     assert_equal('221', reply.code)
     assert_equal('2.0.0 Bye', reply.message)
     assert_equal('QUIT', reply.command)
开发者ID:drewlander,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例12: test_rset

 def test_rset(self):
     self.sock.sendall('RSET\r\n')
     self.sock.recv(IsA(int)).AndReturn('250 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.rset()
     assert_equal('250', reply.code)
     assert_equal('2.0.0 Ok', reply.message)
     assert_equal('RSET', reply.command)
开发者ID:drewlander,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例13: test_data

 def test_data(self):
     self.sock.sendall(b'DATA\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'354 Go ahead\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.data()
     self.assertEqual('354', reply.code)
     self.assertEqual('Go ahead', reply.message)
     self.assertEqual(b'DATA', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例14: test_helo

 def test_helo(self):
     self.sock.sendall(b'HELO there\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 Hello\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.helo('there')
     self.assertEqual('250', reply.code)
     self.assertEqual('Hello', reply.message)
     self.assertEqual(b'HELO', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py

示例15: test_send_empty_data

 def test_send_empty_data(self):
     self.sock.sendall('.\r\n')
     self.sock.recv(IsA(int)).AndReturn('250 2.0.0 Done\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.send_empty_data()
     assert_equal('250', reply.code)
     assert_equal('2.0.0 Done', reply.message)
     assert_equal('[SEND_DATA]', reply.command)
开发者ID:drewlander,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


注:本文中的slimta.smtp.client.Client类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。