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 55 56
|
use strict;
use warnings;
use FindBin;
BEGIN { require "$FindBin::Bin/test-helper-s3-api.pl" }
BEGIN { require "$FindBin::Bin/test-helper-s3-api-error-confess.pl" }
use Shared::Examples::Net::Amazon::S3::API qw[ expect_api_object_acl_get ];
plan tests => 6;
expect_api_object_acl_get 'get bucket acl' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('response::acl'),
expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' },
expect_data => fixture ('response::acl')->{content},
);
expect_api_object_acl_get 'S3 error - Access Denied' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('error::access_denied'),
expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' },
expect_s3_error_access_denied,
);
expect_api_object_acl_get 'S3 error - Bucket Not Found' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('error::no_such_bucket'),
expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' },
expect_s3_error_bucket_not_found,
);
expect_api_object_acl_get 'S3 error - Object Not Found' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('error::no_such_key'),
expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' },
expect_s3_error_object_not_found,
);
expect_api_object_acl_get 'HTTP error - 400 Bad Request' => (
with_bucket => 'some-bucket',
with_key => 'some-key',
with_response_fixture ('error::http_bad_request'),
expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' },
expect_http_error_bad_request,
);
had_no_warnings;
done_testing;
|