本文整理汇总了Python中slimta.smtp.auth.AuthSession类的典型用法代码示例。如果您正苦于以下问题:Python AuthSession类的具体用法?Python AuthSession怎么用?Python AuthSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AuthSession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_plain
def test_plain(self):
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'PLAIN dGVzdHppZAB0ZXN0dXNlcgB0ZXN0cGFzc3dvcmQ=')
self.assertEqual(u'testuser', result.authcid)
self.assertEqual(u'testpassword', result.secret)
self.assertEqual(u'testzid', result.authzid)
开发者ID:madhugb,项目名称:python-slimta,代码行数:7,代码来源:test_slimta_smtp_auth.py
示例2: test_crammd5_malformed
def test_crammd5_malformed(self):
self.sock.sendall(b'334 PHRlc3RAZXhhbXBsZS5jb20+\r\n')
self.sock.recv(IsA(int)).AndReturn(b'bWFsZm9ybWVk\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
with self.assertRaises(ServerAuthError):
auth.server_attempt(b'CRAM-MD5')
开发者ID:madhugb,项目名称:python-slimta,代码行数:7,代码来源:test_slimta_smtp_auth.py
示例3: test_login
def test_login(self):
self.sock.sendall('334 UGFzc3dvcmQ6\r\n')
self.sock.recv(IsA(int)).AndReturn('dGVzdHBhc3N3b3Jk\r\n')
self.mox.ReplayAll()
io = IO(self.sock)
auth = AuthSession(FakeAuth(), FakeSession(True))
identity = auth.server_attempt(io, 'LOGIN dGVzdHVzZXI=')
assert_equal('testidentity', identity)
开发者ID:icksa,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例4: test_client_xoauth2
def test_client_xoauth2(self):
self.sock.sendall(b'AUTH XOAUTH2 dXNlcj10ZXN0QGV4YW1wbGUuY29tAWF1dGg9QmVhcmVyYXNkZgEB\r\n')
self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt('[email protected]', 'asdf', None, 'XOAUTH2')
self.assertEqual('235', reply.code)
self.assertEqual('2.0.0 Ok', reply.message)
开发者ID:sk1p,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例5: test_crammd5_badcreds
def test_crammd5_badcreds(self):
self.sock.sendall('334 PHRlc3RAZXhhbXBsZS5jb20+\r\n')
self.sock.recv(IsA(int)).AndReturn('dGVzdHVzZXIgMTIzNDU2Nzg5MA==\r\n')
self.mox.ReplayAll()
io = IO(self.sock)
auth = AuthSession(FakeAuth(), FakeSession(True))
with assert_raises(CredentialsInvalidError):
auth.server_attempt(io, 'CRAM-MD5 dGVzdHVzZXI=')
开发者ID:icksa,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例6: test_client_bad_mech
def test_client_bad_mech(self):
self.sock.sendall(b'AUTH LOGIN\r\n')
self.sock.recv(IsA(int)).AndReturn(b'535 Nope!\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt('[email protected]', 'asdf', None, 'LOGIN')
self.assertEqual('535', reply.code)
self.assertEqual('5.0.0 Nope!', reply.message)
开发者ID:sk1p,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例7: test_client_plain
def test_client_plain(self):
self.sock.sendall(b'AUTH PLAIN amtsAHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt('[email protected]', 'asdf', 'jkl', 'PLAIN')
self.assertEqual('235', reply.code)
self.assertEqual('2.0.0 Ok', reply.message)
开发者ID:sk1p,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例8: test_plain_noarg
def test_plain_noarg(self):
self.sock.sendall('334 \r\n')
self.sock.recv(IsA(int)).AndReturn('dGVzdHppZAB0ZXN0dXNlcgB0ZXN0cGFzc3dvcmQ=\r\n')
self.mox.ReplayAll()
io = IO(self.sock)
auth = AuthSession(FakeAuth(), FakeSession(True))
identity = auth.server_attempt(io, 'PLAIN')
assert_equal('testidentity', identity)
开发者ID:icksa,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例9: test_crammd5
def test_crammd5(self):
self.sock.sendall('334 PHRlc3RAZXhhbXBsZS5jb20+\r\n')
self.sock.recv(IsA(int)).AndReturn('dGVzdHVzZXIgNDkzMzA1OGU2ZjgyOTRkZTE0NDJkMTYxOTI3ZGI5NDQ=\r\n')
self.mox.ReplayAll()
io = IO(self.sock)
auth = AuthSession(FakeAuth(), FakeSession(True))
identity = auth.server_attempt(io, 'CRAM-MD5 dGVzdHVzZXI=')
assert_equal('testidentity', identity)
开发者ID:icksa,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例10: test_plain_badcreds
def test_plain_badcreds(self):
self.mox.ReplayAll()
io = IO(self.sock)
auth = AuthSession(FakeAuth(), FakeSession(True))
with assert_raises(CredentialsInvalidError):
auth.server_attempt(io, 'PLAIN dGVzdHppZAB0ZXN0dXNlcgBiYWRwYXNzd29yZA==')
with assert_raises(ServerAuthError):
auth.server_attempt(io, 'PLAIN dGVzdGluZw==')
开发者ID:icksa,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例11: test_crammd5_malformed
def test_crammd5_malformed(self):
self.sock.sendall('334 PHRlc3RAZXhhbXBsZS5jb20+\r\n')
self.sock.recv(IsA(int)).AndReturn('bWFsZm9ybWVk\r\n')
self.mox.ReplayAll()
io = IO(self.sock)
auth = AuthSession(FakeAuth(), FakeSession(True))
with assert_raises(ServerAuthError):
auth.server_attempt(io, 'CRAM-MD5 dGVzdHVzZXI=')
开发者ID:icksa,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_auth.py
示例12: test_plain_canceled
def test_plain_canceled(self):
self.sock.sendall(b'334 \r\n')
self.sock.recv(IsA(int)).AndReturn(b'*\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
with self.assertRaises(AuthenticationCanceled):
auth.server_attempt(b'PLAIN')
with self.assertRaises(AuthenticationCanceled):
auth.server_attempt(b'PLAIN *')
开发者ID:madhugb,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_auth.py
示例13: test_login
def test_login(self):
self.sock.sendall(b'334 UGFzc3dvcmQ6\r\n')
self.sock.recv(IsA(int)).AndReturn(b'dGVzdHBhc3N3b3Jk\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'LOGIN dGVzdHVzZXI=')
self.assertEqual(u'testuser', result.authcid)
self.assertEqual(u'testpassword', result.secret)
self.assertEqual(None, result.authzid)
开发者ID:madhugb,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_auth.py
示例14: test_plain_noarg
def test_plain_noarg(self):
self.sock.sendall(b'334 \r\n')
self.sock.recv(IsA(int)).AndReturn(b'dGVzdHppZAB0ZXN0dXNlcgB0ZXN0cGFzc3dvcmQ=\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'PLAIN')
self.assertEqual(u'testuser', result.authcid)
self.assertEqual(u'testpassword', result.secret)
self.assertEqual(u'testzid', result.authzid)
开发者ID:madhugb,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_auth.py
示例15: test_client_crammd5
def test_client_crammd5(self):
self.sock.sendall(b'AUTH CRAM-MD5\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 dGVzdCBjaGFsbGVuZ2U=\r\n')
self.sock.sendall(b'dGVzdEBleGFtcGxlLmNvbSA1Yzk1OTBjZGE3ZTgxMDY5Mzk2ZjhiYjlkMzU1MzE1Yg==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt('[email protected]', 'asdf', None, 'CRAM-MD5')
self.assertEqual('235', reply.code)
self.assertEqual('2.0.0 Ok', reply.message)
开发者ID:sk1p,项目名称:python-slimta,代码行数:10,代码来源:test_slimta_smtp_auth.py
示例16: test_plain_canceled
def test_plain_canceled(self):
self.sock.sendall('334 \r\n')
self.sock.recv(IsA(int)).AndReturn('*\r\n')
self.mox.ReplayAll()
io = IO(self.sock)
auth = AuthSession(FakeAuth(), FakeSession(True))
with assert_raises(AuthenticationCanceled):
auth.server_attempt(io, 'PLAIN')
with assert_raises(AuthenticationCanceled):
auth.server_attempt(io, 'PLAIN *')
开发者ID:icksa,项目名称:python-slimta,代码行数:10,代码来源:test_slimta_smtp_auth.py
示例17: test_client_login_bad_username
def test_client_login_bad_username(self):
self.sock.sendall(b'AUTH LOGIN\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 VXNlcm5hbWU6\r\n')
self.sock.sendall(b'dGVzdEBleGFtcGxlLmNvbQ==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'535 Nope!\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt('[email protected]', 'asdf', None, 'LOGIN')
self.assertEqual('535', reply.code)
self.assertEqual('5.0.0 Nope!', reply.message)
开发者ID:sk1p,项目名称:python-slimta,代码行数:10,代码来源:test_slimta_smtp_auth.py
示例18: test_client_xoauth2_error
def test_client_xoauth2_error(self):
self.sock.sendall(b'AUTH XOAUTH2 dXNlcj10ZXN0QGV4YW1wbGUuY29tAWF1dGg9QmVhcmVyYXNkZgEB\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoiaHR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K\r\n')
self.sock.sendall(b'\r\n')
self.sock.recv(IsA(int)).AndReturn(b'535 Nope!\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt('[email protected]', 'asdf', None, 'XOAUTH2')
self.assertEqual('535', reply.code)
self.assertEqual('5.0.0 Nope!', reply.message)
开发者ID:sk1p,项目名称:python-slimta,代码行数:10,代码来源:test_slimta_smtp_auth.py
示例19: test_crammd5
def test_crammd5(self):
self.sock.sendall(b'334 PHRlc3RAZXhhbXBsZS5jb20+\r\n')
self.sock.recv(IsA(int)).AndReturn(b'dGVzdHVzZXIgNDkzMzA1OGU2ZjgyOTRkZTE0NDJkMTYxOTI3ZGI5NDQ=\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'CRAM-MD5')
self.assertEqual(u'testuser', result.authcid)
self.assertTrue(result.check_secret(u'testpassword'))
self.assertFalse(result.check_secret(u'testwrong'))
self.assertEqual(None, result.authzid)
开发者ID:madhugb,项目名称:python-slimta,代码行数:10,代码来源:test_slimta_smtp_auth.py
示例20: test_client_login
def test_client_login(self):
self.sock.sendall(b'AUTH LOGIN\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 VXNlcm5hbWU6\r\n')
self.sock.sendall(b'dGVzdEBleGFtcGxlLmNvbQ==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 UGFzc3dvcmQ6\r\n')
self.sock.sendall(b'YXNkZg==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt('[email protected]', 'asdf', None, 'LOGIN')
self.assertEqual('235', reply.code)
self.assertEqual('2.0.0 Ok', reply.message)
开发者ID:sk1p,项目名称:python-slimta,代码行数:12,代码来源:test_slimta_smtp_auth.py
注:本文中的slimta.smtp.auth.AuthSession类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论