From 4de4894074387a6506aaec9d3a0163c58ed287c2 Mon Sep 17 00:00:00 2001 From: Ted Zhu Date: Fri, 31 Aug 2018 07:57:24 +0000 Subject: [PATCH] Fix the bug that can not remove the file on aws --- tc_aws/aws/storage.py | 8 +++----- vows/storage_vows.py | 12 ++---------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/tc_aws/aws/storage.py b/tc_aws/aws/storage.py index 792b935..450aac5 100644 --- a/tc_aws/aws/storage.py +++ b/tc_aws/aws/storage.py @@ -81,15 +81,13 @@ def set(self, bytes, abspath, callback=None): callback=callback, ) - def remove(self, path): + @return_future + def remove(self, path, callback=None): """ Deletes data at path :param string path: Path to delete - :return: Whether deletion is successful or not - :rtype: bool """ - yield self.storage.delete(path) - return + self.storage.delete(path) @return_future def exists(self, path, callback): diff --git a/vows/storage_vows.py b/vows/storage_vows.py index 7f2981e..ef0727a 100644 --- a/vows/storage_vows.py +++ b/vows/storage_vows.py @@ -99,16 +99,8 @@ def topic(self, callback): config = Config(TC_AWS_STORAGE_BUCKET=s3_bucket) storage = Storage(Context(config=config, server=get_server('ACME-SEC'))) storage.put(IMAGE_URL % '4', IMAGE_BYTES) # 1: we put the image - - def check_created(created): - expect(created).to_equal(True) # 2.1: assertion... - - def once_removed(rm): - storage.exists(IMAGE_URL % '4', callback=callback) #4: we check if the image exists - - storage.remove(IMAGE_URL % '4', callback=once_removed) # 3: we delete it - - storage.exists(IMAGE_URL % '4', callback=check_created) # 2: we check it exists + storage.remove(IMAGE_URL % '4') # 2: we delete it + storage.exists(IMAGE_URL % '4', callback=callback) # 3: we check it exists def should_be_put_and_removed(self, topic): expect(topic.args[0]).to_equal(False) # 4.1: assertion...