S3/Request/SetBucketPolicy.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 27 CC 1 SCAR 6.9
CC
1
Cov
0%
request
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1  
2 package AWS::S3::Request::SetBucketPolicy;
3  
4 use Moose;
5 use AWS::S3::Signer;
6 use AWS::S3::ResponseParser;
7 use JSON::XS;
8  
9 with 'AWS::S3::Roles::Request';
10  
11 has 'bucket' => ( is => 'ro', isa => 'Str', required => 1 );
12  
13 has '_subresource' => (
14 is => 'ro',
15 isa => 'Str',
16 init_arg => undef,
17 default => 'policy'
18 );
19  
20 has 'policy' => (
21 is => 'ro',
22 isa => 'Maybe[Str]',
23 required => 1,
24  
25 # Evan Carroll 6/14/2012
26 # COMMENTED THIS OUT, not sure if it ever worked on VSO
27 # Must be able to decode the JSON string:
28 # where => sub {
29 # eval { decode_json( $_ ); 1 };
30 # }
31 );
32  
33 has '+_expect_nothing' => ( default => 1 );
34  
35 sub request {
36 my $s = shift;
37  
38 my $signer = AWS::S3::Signer->new(
39 s3 => $s->s3,
40 method => 'PUT',
41 uri => $s->_uri,
42 content => \$s->policy,
43 content_type => '',
44 content_md5 => '',
45 );
46  
47 #warn "SetPolicy.string_to_sign(" . $signer->string_to_sign . ")";
48 $s->_send_request(
49 $signer->method => $signer->uri => {
50 Authorization => $signer->auth_header,
51 Date => $signer->date,
52 },
53 $s->policy
54 );
55 } # end request()
56  
57 __PACKAGE__->meta->make_immutable;