def test_wait_pasv_timeout_fail_short(loop, client, server, *, tmp_dir): f = tmp_dir / "foo.txt" b = b"foobar" yield from client.login() yield from client.command("STOR " + f.name) yield from asyncio.sleep(0.5, loop=loop) reader, writer = yield from client.get_passive_connection("I") with contextlib.closing(writer) as writer: writer.write(b) yield from writer.drain() yield from client.command(None, "2xx", "1xx") yield from client.quit() with f.open("rb") as fin: rb = fin.read() f.unlink() nose.tools.eq_(b, rb)
def test_wait_pasv_timeout_ok_but_too_long(loop, client, server, *, tmp_dir): f = tmp_dir / "foo.txt" b = b"foobar" yield from client.login() yield from client.command("TYPE I", "200") code, info = yield from client.command("PASV", "227") ip, port = client.parse_address_response(info[-1]) yield from client.command("STOR " + f.name) yield from asyncio.sleep(2, loop=loop) reader, writer = yield from aioftp.client.open_connection(ip, port, loop, client.create_connection) with contextlib.closing(writer) as writer: writer.write(b) yield from writer.drain() yield from client.command(None, "2xx", "1xx") yield from client.quit() with f.open("rb") as fin: rb = fin.read() f.unlink() nose.tools.eq_(b, rb)
def test_wait_pasv_timeout_ok_but_too_long(loop, client, server, *, tmp_dir): f = tmp_dir / "foo.txt" b = b"foobar" yield from client.login() yield from client.command("TYPE I", "200") code, info = yield from client.command("PASV", "227") ip, port = client.parse_address_response(info[-1]) yield from client.command("STOR " + f.name) yield from asyncio.sleep(2, loop=loop) reader, writer = yield from aioftp.client.open_connection( ip, port, loop, client.create_connection, ) with contextlib.closing(writer) as writer: writer.write(b) yield from writer.drain() yield from client.command(None, "2xx", "1xx") yield from client.quit() with f.open("rb") as fin: rb = fin.read() f.unlink() nose.tools.eq_(b, rb)
def coro(): try: yield from server.start(None, 8888) yield from client.connect("127.0.0.1", 8888) yield from client.login() finally: server.close() yield from server.wait_closed()
def test_client_path_timeout(loop, client, server, *, tmp_dir): f = tmp_dir / "foo.txt" with f.open("wb") as fout: fout.write(b"-" * 1024) yield from client.login() try: yield from client.download("foo.txt", "/foo.txt", write_into=True) finally: f.unlink()
def test_server_path_timeout(loop, client, server): yield from client.login() yield from client.make_directory("foo")
def test_idle_timeout(loop, client, server): yield from asyncio.sleep(2, loop=loop) yield from client.login()