File: client-service-buckets-list.t

package info (click to toggle)
libnet-amazon-s3-perl 0.991-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,620 kB
  • sloc: perl: 9,906; makefile: 20
file content (65 lines) | stat: -rw-r--r-- 1,975 bytes parent folder | download | duplicates (3)
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
57
58
59
60
61
62
63
64
65

use strict;
use warnings;

use FindBin;

BEGIN { require "$FindBin::Bin/test-helper-s3-client.pl" }

use Shared::Examples::Net::Amazon::S3::Client qw[ expect_client_list_all_my_buckets ];

plan tests => 5;

expect_client_list_all_my_buckets 'list all my buckets with displayname' => (
	with_response_fixture ('response::service_list_buckets_with_owner_displayname'),
	expect_request      => { GET => 'https://s3.amazonaws.com/' },
	expect_data         => [
		all (
			obj_isa ('Net::Amazon::S3::Client::Bucket'),
			methods (name => 'quotes'),
			methods (owner_id => 'bcaf1ffd86f461ca5fb16fd081034f'),
			methods (owner_display_name => 'webfile'),
		),
		all (
			obj_isa ('Net::Amazon::S3::Client::Bucket'),
			methods (name => 'samples'),
			methods (owner_id => 'bcaf1ffd86f461ca5fb16fd081034f'),
			methods (owner_display_name => 'webfile'),
		),
	],
);

expect_client_list_all_my_buckets 'list all my buckets without displayname' => (
	with_response_fixture ('response::service_list_buckets_without_owner_displayname'),
	expect_request      => { GET => 'https://s3.amazonaws.com/' },
	expect_data         => [
		all (
			obj_isa ('Net::Amazon::S3::Client::Bucket'),
			methods (name => 'quotes'),
			methods (owner_id => 'bcaf1ffd86f461ca5fb16fd081034f'),
			methods (owner_display_name => ''),
		),
		all (
			obj_isa ('Net::Amazon::S3::Client::Bucket'),
			methods (name => 'samples'),
			methods (owner_id => 'bcaf1ffd86f461ca5fb16fd081034f'),
			methods (owner_display_name => ''),
		),
	],
);

expect_client_list_all_my_buckets 'S3 error - Access Denied' => (
	with_response_fixture ('error::access_denied'),
	expect_request      => { GET => 'https://s3.amazonaws.com/' },
	expect_s3_error_access_denied,
);

expect_client_list_all_my_buckets 'HTTP error - 400 Bad Request' => (
	with_response_fixture ('error::http_bad_request'),
	expect_request      => { GET => 'https://s3.amazonaws.com/' },
	expect_http_error_bad_request,
);

had_no_warnings;

done_testing;