Skip to content

Commit

Permalink
Merge pull request #141 from eitanshapiro/master
Browse files Browse the repository at this point in the history
fix delete file scenario. Was missing normalization from path to abspath
  • Loading branch information
kkopachev authored Feb 24, 2020
2 parents 2156df6 + 6728e92 commit bc10f51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tc_aws/aws/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ def set(self, bytes, abspath, callback=None):
)

@return_future
def remove(self, path, callback=None):
def remove(self, abspath, callback=None):
"""
Deletes data at path
:param string path: Path to delete
Deletes data at abspath
:param string abspath: Absolute path to delete
"""
self.storage.delete(path, callback)
self.storage.delete(abspath, callback)

@return_future
def exists(self, path, callback):
Expand Down
8 changes: 8 additions & 0 deletions tc_aws/storages/s3_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ def once_written(response):

self.set(bytes, self._normalize_path(path), callback=once_written)

@return_future
def remove(self, path, callback=None):
"""
Deletes data at path
:param string path: Path to delete
"""
super(Storage, self).remove(self._normalize_path(path), callback)

@return_future
def get(self, path, callback):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_can_get_image_inexistance(self):

@gen_test
def test_can_remove_instance(self):
config = Config(TC_AWS_STORAGE_BUCKET=s3_bucket)
config = Config(TC_AWS_STORAGE_BUCKET=s3_bucket,TC_AWS_STORAGE_ROOT_PATH='nana')
storage = Storage(Context(config=config, server=get_server('ACME-SEC')))
yield storage.put(IMAGE_URL % '4', IMAGE_BYTES)
yield storage.remove(IMAGE_URL % '4')
Expand Down

0 comments on commit bc10f51

Please sign in to comment.