File: s3-operation-bucket-create.t

package info (click to toggle)
libnet-amazon-s3-perl 0.991-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,620 kB
  • sloc: perl: 9,906; makefile: 20
file content (76 lines) | stat: -rw-r--r-- 1,656 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
66
67
68
69
70
71
72
73
74
75
76
#!perl

use strict;
use warnings;

use FindBin;

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

expect_operation_bucket_create (
	'API / legacy'                      => \& api_bucket_create_legacy,
	'API / named arguments'             => \& api_bucket_create_named,
	'API / trailing named arguments'    => \& api_bucket_create_trailing_named,
	'API / trailing configuration hash' => \& api_bucket_create_trailing_conf,
	'Client' => \& client_bucket_create,
);

had_no_warnings;

done_testing;

sub api_bucket_create_legacy {
	my (%args) = @_;

	build_default_api->add_bucket (\ %args);
}

sub api_bucket_create_named {
	my (%args) = @_;

	build_default_api->add_bucket (%args);
}

sub api_bucket_create_trailing_named {
	my (%args) = @_;

	build_default_api->add_bucket (delete $args{bucket}, %args);
}

sub api_bucket_create_trailing_conf {
	my (%args) = @_;

	build_default_api->add_bucket (delete $args{bucket}, \%args);
}

sub client_bucket_create {
	my (%args) = @_;

	build_default_client->create_bucket (name => delete $args{bucket}, %args);
}

sub expect_operation_bucket_create {
	expect_operation_plan
		implementations => +{ @_ },
		expect_operation => 'Net::Amazon::S3::Operation::Bucket::Create',
		plan => {
			"create bucket with name" => {
				act_arguments => [
					bucket => 'bucket-name',
				],
			},
			"create bucket with location constraint" => {
				act_arguments => [
					bucket => 'bucket-name',
					location_constraint => 'eu-west-1',
				],
			},
			"create bucket with acl" => {
				act_arguments => [
					bucket    => 'bucket-name',
					acl_short => 'private',
					acl       => 'public',
				],
			},
		}
}