test_delete.py 1.1 KB

12345678910111213141516171819202122232425262728
  1. # Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"). You
  4. # may not use this file except in compliance with the License. A copy of
  5. # the License is located at
  6. #
  7. # http://aws.amazon.com/apache2.0/
  8. #
  9. # or in the "license" file accompanying this file. This file is
  10. # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  11. # ANY KIND, either express or implied. See the License for the specific
  12. # language governing permissions and limitations under the License.
  13. from tests.integration import BaseTransferManagerIntegTest
  14. class TestDeleteObject(BaseTransferManagerIntegTest):
  15. def test_can_delete_object(self):
  16. key_name = 'mykey'
  17. self.client.put_object(
  18. Bucket=self.bucket_name, Key=key_name, Body=b'hello world'
  19. )
  20. self.assertTrue(self.object_exists(key_name))
  21. transfer_manager = self.create_transfer_manager()
  22. future = transfer_manager.delete(bucket=self.bucket_name, key=key_name)
  23. future.result()
  24. self.assertTrue(self.object_not_exists(key_name))