Skip to content

Commit

Permalink
Merge pull request #124 from Tideorz/master
Browse files Browse the repository at this point in the history
Fix the bug that can not remove the file on aws
  • Loading branch information
Bladrak authored Sep 5, 2018
2 parents 07f0c09 + 4de4894 commit 7b40255
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
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

0 comments on commit 7b40255

Please sign in to comment.