Lines Matching refs:client
471 self.client = ftplib.FTP(timeout=TIMEOUT)
472 self.client.connect(self.server.host, self.server.port)
475 self.client.close()
486 self.assertEqual(self.client.getwelcome(), '220 welcome')
489 self.assertEqual(self.client.sanitize('foo'), repr('foo'))
490 self.assertEqual(self.client.sanitize('pass 12345'), repr('pass *****'))
491 self.assertEqual(self.client.sanitize('PASS 12345'), repr('PASS *****'))
494 self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\r\n0')
495 self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\n0')
496 self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\r0')
497 self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 400')
498 self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 499')
499 self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 500')
500 self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 599')
501 self.assertRaises(ftplib.error_proto, self.client.sendcmd, 'echo 999')
515 self.assertTrue(self.client.passiveserver)
516 self.client.set_pasv(True)
517 self.assertTrue(self.client.passiveserver)
518 self.client.set_pasv(False)
519 self.assertFalse(self.client.passiveserver)
522 self.client.voidcmd('echo 200')
523 self.client.voidcmd('echo 299')
524 self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 199')
525 self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 300')
528 self.client.login()
531 self.client.acct('passwd')
534 self.client.rename('a', 'b')
536 self.assertRaises(ftplib.error_reply, self.client.rename, 'a', 'b')
539 self.client.delete('foo')
541 self.assertRaises(ftplib.error_reply, self.client.delete, 'foo')
544 self.client.size('foo')
547 dir = self.client.mkd('/foo')
551 self.client.rmd('foo')
554 dir = self.client.cwd('/foo')
558 dir = self.client.pwd()
562 self.assertEqual(self.client.quit(), '221 quit ok')
564 self.assertEqual(self.client.sock, None)
567 self.client.abort()
573 self.client.retrbinary('retr', callback)
581 self.client.retrbinary('retr', callback, rest=rest)
586 self.client.retrlines('retr', received.append)
591 self.client.storbinary('stor', f)
596 self.client.storbinary('stor', f, callback=lambda x: flag.append(None))
603 self.client.storbinary('stor', f, rest=r)
608 self.client.storlines('stor', f)
613 self.client.storlines('stor foo', f, callback=lambda x: flag.append(None))
619 self.assertRaises(TypeError, self.client.storlines, 'stor foo', f)
622 self.client.nlst()
623 self.assertEqual(self.client.nlst(), NLST_DATA.split('\r\n')[:-1])
627 self.client.dir(lambda x: l.append(x))
631 list(self.client.mlsd())
632 list(self.client.mlsd(path='/'))
633 list(self.client.mlsd(path='/', facts=['size', 'type']))
635 ls = list(self.client.mlsd())
653 _name, facts = next(self.client.mlsd())
678 _name, facts = next(self.client.mlsd())
683 self.assertRaises(StopIteration, next, self.client.mlsd())
685 for x in self.client.mlsd():
689 with self.client.makeport():
695 host, port = self.client.makepasv()
702 self.client.quit()
705 if self.client.sock is None:
708 self.client.sendcmd('noop')
714 with ftplib.FTP(timeout=TIMEOUT) as self.client:
715 self.client.connect(self.server.host, self.server.port)
716 self.client.sendcmd('noop')
722 with ftplib.FTP(timeout=TIMEOUT) as self.client:
723 self.client.connect(self.server.host, self.server.port)
724 self.client.sendcmd('noop')
725 self.client.quit()
732 with ftplib.FTP(timeout=TIMEOUT) as self.client:
733 self.client.connect(self.server.host, self.server.port)
734 self.client.sendcmd('noop')
747 self.client.quit()
750 self.client.connect(self.server.host, self.server.port,
752 self.assertEqual(self.client.sock.getsockname()[1], port)
753 self.client.quit()
761 self.client.source_address = (HOST, port)
763 with self.client.transfercmd('list') as sock:
783 self.assertRaises(ftplib.Error, self.client.sendcmd,
784 'x' * self.client.maxline * 2)
787 self.client.sendcmd('SETLONGRETR %d' % (self.client.maxline * 2))
790 self.client.retrlines, 'retr', received.append)
793 f = io.BytesIO(b'x' * self.client.maxline * 2)
794 self.assertRaises(ftplib.Error, self.client.storlines, 'stor', f)
803 self.client = ftplib.FTP(timeout=TIMEOUT)
804 self.client.connect(self.server.host, self.server.port)
807 self.client.close()
814 self.assertEqual(self.client.af, socket.AF_INET6)
817 with self.client.makeport():
822 host, port = self.client.makepasv()
832 self.client.retrbinary('retr', callback)
835 self.client.set_pasv(True)
837 self.client.set_pasv(False)
850 self.client = ftplib.FTP_TLS(timeout=TIMEOUT)
851 self.client.connect(self.server.host, self.server.port)
853 self.client.auth()
854 self.client.prot_p()
864 self.client = ftplib.FTP_TLS(timeout=TIMEOUT)
865 self.client.connect(self.server.host, self.server.port)
868 self.client.close()
875 self.assertNotIsInstance(self.client.sock, ssl.SSLSocket)
876 self.client.auth()
877 self.assertIsInstance(self.client.sock, ssl.SSLSocket)
881 with self.client.transfercmd('list') as sock:
884 self.assertEqual(self.client.voidresp(), "226 transfer complete")
887 self.client.prot_p()
888 with self.client.transfercmd('list') as sock:
893 self.assertEqual(self.client.voidresp(), "226 transfer complete")
896 self.client.prot_c()
897 with self.client.transfercmd('list') as sock:
900 self.assertEqual(self.client.voidresp(), "226 transfer complete")
904 self.assertNotIsInstance(self.client.sock, ssl.SSLSocket)
905 self.client.login()
906 self.assertIsInstance(self.client.sock, ssl.SSLSocket)
908 self.client.login()
911 self.client.auth()
912 self.assertRaises(ValueError, self.client.auth)
915 self.client.quit()
926 self.client = ftplib.FTP_TLS(context=ctx, timeout=TIMEOUT)
927 self.client.connect(self.server.host, self.server.port)
928 self.assertNotIsInstance(self.client.sock, ssl.SSLSocket)
929 self.client.auth()
930 self.assertIs(self.client.sock.context, ctx)
931 self.assertIsInstance(self.client.sock, ssl.SSLSocket)
933 self.client.prot_p()
934 with self.client.transfercmd('list') as sock:
939 self.assertRaises(ValueError, self.client.ccc)
940 self.client.login(secure=True)
941 self.assertIsInstance(self.client.sock, ssl.SSLSocket)
942 self.client.ccc()
943 self.assertRaises(ValueError, self.client.sock.unwrap)
947 self.client.quit()
952 self.client = ftplib.FTP_TLS(context=ctx, timeout=TIMEOUT)
955 self.client.connect(self.server.host, self.server.port)
957 self.client.auth()
960 self.client.connect(self.server.host, self.server.port)
961 self.client.prot_p()
963 with self.client.transfercmd("list") as sock:
965 self.client.quit()
967 self.client.connect("localhost", self.server.port)
968 self.client.auth()
969 self.client.quit()
971 self.client.connect("localhost", self.server.port)
972 self.client.prot_p()
973 with self.client.transfercmd("list") as sock: