| 372 | | # |
|---|
| 373 | | # def test_read_from_host(self): |
|---|
| 374 | | # """Test _FTPFile.read*""" |
|---|
| 375 | | # host = self.host |
|---|
| 376 | | # host.chdir(self.testdir) |
|---|
| 377 | | # self.remote_name = '__test.dat' |
|---|
| 378 | | # self.ascii_read() |
|---|
| 379 | | # self.ascii_readline() |
|---|
| 380 | | # self.binary_readline() |
|---|
| 381 | | # self.ascii_readlines() |
|---|
| 382 | | # self.ascii_xreadlines() |
|---|
| 383 | | # # clean up |
|---|
| 384 | | # host.remove(self.remote_name) |
|---|
| 385 | | # host.chdir(self.rootdir) |
|---|
| 386 | | # |
|---|
| 387 | | # def test_remote_copy(self): |
|---|
| 388 | | # """Make a copy on the remote host.""" |
|---|
| 389 | | # host = self.host |
|---|
| 390 | | # host.chdir(self.testdir) |
|---|
| 391 | | # self.remote_name = '__test.dat' |
|---|
| 392 | | # local_data = '\000a\001b\r\n\002c\003\n\004\r\005' |
|---|
| 393 | | # # write later source data |
|---|
| 394 | | # self.write_test_data(local_data, 'wb') |
|---|
| 395 | | # # build paths |
|---|
| 396 | | # source_path = self.remote_name |
|---|
| 397 | | # host.mkdir('__test2') |
|---|
| 398 | | # target_path = host.path.join('__test2', |
|---|
| 399 | | # self.remote_name) |
|---|
| 400 | | # # make file objects |
|---|
| 401 | | # source = host.file(source_path, 'rb') |
|---|
| 402 | | # target = host.file(target_path, 'wb') |
|---|
| 403 | | # # copy |
|---|
| 404 | | # host.copyfileobj(source, target) |
|---|
| 405 | | # source.close() |
|---|
| 406 | | # target.close() |
|---|
| 407 | | # # read copy and check against original data |
|---|
| 408 | | # input_ = host.file(target_path, 'rb') |
|---|
| 409 | | # data = input_.read() |
|---|
| 410 | | # input_.close() |
|---|
| 411 | | # self.assertEqual(local_data, data) |
|---|
| 412 | | # # clean up |
|---|
| 413 | | # host.remove(target_path) |
|---|
| 414 | | # host.rmdir('__test2') |
|---|
| 415 | | # host.unlink(source_path) |
|---|
| 416 | | # host.chdir(self.rootdir) |
|---|
| | 372 | |
|---|