def test_non_boto_error(self, s3_bucket):
     self.driver_config['bucket'] = lambda x: None
     with pytest.raises(AttributeError):
         S3ObjectStorageDriver(self.driver_config)
 def test_404(self, s3_bucket):
     self.driver_config['bucket'] = 'bogus'
     with pytest.raises(exc.BucketNotFoundError):
         S3ObjectStorageDriver(self.driver_config)
 def test_400(self, s3_bucket):
     self.driver_config['secret_key'] = 'bogus'
     with pytest.raises(exc.BadCredentialsError):
         S3ObjectStorageDriver(self.driver_config)
 def test_key_is_removed(self, s3_bucket, s3_client):
     S3ObjectStorageDriver(self.driver_config)
     response = s3_client.list_objects_v2(Bucket=test_s3_bucket)
     assert response.get('Contents') is None
 def test_check_is_valid(self, s3_bucket):
     S3ObjectStorageDriver(self.driver_config)
 def test_403(self, s3_bucket):
     self.driver_config["access_key"] = "bogus"
     with pytest.raises(exc.BadCredentialsError):
         S3ObjectStorageDriver(self.driver_config)