def test_copy_source(self): storage_bucket = tempfile.mkdtemp() fd, fpath = tempfile.mkstemp(prefix="tfile", dir=storage_bucket, text=True) client = FSFileClient(storage_bucket) client.copy_source(os.path.split(fpath)[-1], "new_tfile") self.assert_(os.path.isfile(fpath)) self.assert_(os.path.isfile(os.path.join(storage_bucket, "new_tfile"))) # clean up client.delete("new_tfile") self.assert_(not os.path.isfile(os.path.join(storage_bucket, "new_tfile")))
def test_delete(self): storage_bucket = tempfile.mkdtemp() fd, fpath = tempfile.mkstemp(prefix="tfile", dir=storage_bucket, text=True) os.write(fd, "file") os.close(fd) client = FSFileClient(storage_bucket) client.delete("notexisted") self.assert_(os.path.isfile(fpath)) client.delete(os.path.split(fpath)[-1]) self.assert_(not os.path.isfile(fpath))