1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
use strict;
use warnings;
use FindBin;
BEGIN { require "$FindBin::Bin/test-helper-s3-api.pl" }
use Shared::Examples::Net::Amazon::S3::API qw[ expect_api_object_delete ];
plan tests => 6;
expect_api_object_delete 'delete object' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' },
expect_data => bool (1),
);
expect_api_object_delete 'error access denied' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('error::access_denied'),
expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' },
expect_s3_error_access_denied,
);
expect_api_object_delete 'error no such bucket' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('error::no_such_bucket'),
expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' },
expect_s3_error_bucket_not_found,
);
expect_api_object_delete 'error no such key' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('error::no_such_key'),
expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' },
expect_s3_error_object_not_found,
);
expect_api_object_delete 'HTTP error - 400 Bad Request' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('error::http_bad_request'),
expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' },
expect_http_error_bad_request,
);
had_no_warnings;
done_testing;
|