示例#1
0
 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('*****@*****.**', 'asdf', mechanism=b'PLAIN')
     self.assertEqual('535', reply.code)
     self.assertEqual('5.0.0 Nope!', reply.message)
     self.assertEqual(b'AUTH', reply.command)
 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("*****@*****.**", "asdf", mechanism=b"PLAIN")
     self.assertEqual("535", reply.code)
     self.assertEqual("5.0.0 Nope!", reply.message)
     self.assertEqual(b"AUTH", reply.command)
 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('*****@*****.**', 'asdf', mechanism=b'PLAIN')
     self.assertEqual('535', reply.code)
     self.assertEqual('5.0.0 Nope!', reply.message)
     self.assertEqual(b'AUTH', reply.command)
 def test_auth(self):
     self.sock.sendall(b"AUTH PLAIN AHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"235 Ok\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     client.extensions.add("AUTH", b"PLAIN")
     reply = client.auth("*****@*****.**", "asdf")
     self.assertEqual("235", reply.code)
     self.assertEqual("2.0.0 Ok", reply.message)
     self.assertEqual(b"AUTH", reply.command)
示例#5
0
 def test_auth(self):
     self.sock.sendall(b'AUTH PLAIN AHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     client.extensions.add('AUTH', b'PLAIN')
     reply = client.auth('*****@*****.**', 'asdf')
     self.assertEqual('235', reply.code)
     self.assertEqual('2.0.0 Ok', reply.message)
     self.assertEqual(b'AUTH', reply.command)
 def test_auth(self):
     self.sock.sendall(b'AUTH PLAIN AHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     client.extensions.add('AUTH', b'PLAIN')
     reply = client.auth('*****@*****.**', 'asdf')
     self.assertEqual('235', reply.code)
     self.assertEqual('2.0.0 Ok', reply.message)
     self.assertEqual(b'AUTH', reply.command)
 def test_auth(self):
     sock = self.mox.CreateMock(SSLSocket)
     sock.fileno = lambda: -1
     sock.getpeername = lambda: ('test', 0)
     sock.sendall(b'AUTH PLAIN AHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n')
     sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(sock)
     client.extensions.add('AUTH', 'PLAIN')
     reply = client.auth('*****@*****.**', 'asdf')
     self.assertEqual('235', reply.code)
     self.assertEqual('2.0.0 Ok', reply.message)
     self.assertEqual(b'AUTH', reply.command)
 def test_auth(self):
     sock = self.mox.CreateMock(SSLSocket)
     sock.fileno = lambda: -1
     sock.getpeername = lambda: ('test', 0)
     sock.sendall(b'AUTH PLAIN AHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n')
     sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(sock)
     client.extensions.add('AUTH', 'PLAIN')
     reply = client.auth('*****@*****.**', 'asdf')
     self.assertEqual('235', reply.code)
     self.assertEqual('2.0.0 Ok', reply.message)
     self.assertEqual(b'AUTH', reply.command)