| 68 | self.assertFalse(io.exists(test_fake_file)) |
| 69 | |
| 70 | def test_move(self): |
| 71 | tmp_name = uuid.uuid4().hex |
| 72 | tmp_file_name = '%s.txt' % tmp_name |
| 73 | tmp_file_path = os.path.join(TMP_DIR_OSS, tmp_file_name) |
| 74 | target_dir = os.path.join(TMP_DIR_OSS + 'test_move1_%s' % tmp_name) |
| 75 | with io.open(tmp_file_path, 'a') as f: |
| 76 | f.write('aaa') |
| 77 | |
| 78 | # test move file |
| 79 | target_path = os.path.join(target_dir, tmp_file_name) |
| 80 | io.move(tmp_file_path, target_path) |
| 81 | self.assertFalse(io.exists(tmp_file_path)) |
| 82 | self.assertTrue(io.exists(target_path)) |
| 83 | # test move dir |
| 84 | target_dir2 = os.path.join(TMP_DIR_OSS, 'test_move2_%s' % tmp_name) |
| 85 | io.move(target_dir, target_dir2) |
| 86 | self.assertFalse(io.exists(target_dir)) |
| 87 | self.assertTrue(io.exists(os.path.join(target_dir2, tmp_file_name))) |
| 88 | io.remove(target_dir2) |
| 89 | |
| 90 | def test_copy(self): |
| 91 | # test copy file from oss to local |