Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the bug that can not remove the file on aws #124

Merged
merged 1 commit into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions tc_aws/aws/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 2 additions & 10 deletions vows/storage_vows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down