« Net/Amazon/S3/Operation/Buckets/List/Response.pm
↑ Summary
Net/Amazon/S3/Request/Role/Query/Action.pm »
| 1 | package Shared::Examples::Net::Amazon::S3::Fixture; | ||||||||||
| 2 | # ABSTRACT: used for testing to provide test fixtures | ||||||||||
| 3 | 40 | $Shared::Examples::Net::Amazon::S3::Fixture::VERSION = '0.992'; | |||||||||
| 4 | 40 | ▶ | use parent qw[ Exporter::Tiny ]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 40 | ▶ | use HTTP::Status; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 40 | our @EXPORT_OK = ( | |||||||||
| 9 | qw[ error_fixture ], | ||||||||||
| 10 | qw[ response_fixture ], | ||||||||||
| 11 | qw[ fixture ], | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | 86 | ▶ | sub response_fixture { | ||||||||
|
Subroutine
response_fixture: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | 86 | my (%params) = @_; | |||||||||
| 16 | |||||||||||
| 17 | return +{ | ||||||||||
| 18 | content_type => 'application/xml', | ||||||||||
| 19 | content_length => length $params{with_response_data}, | ||||||||||
| 20 | 86 | response_code => HTTP::Status::HTTP_OK, | |||||||||
| 21 | |||||||||||
| 22 | %params, | ||||||||||
| 23 | }; | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 33 | ▶ | sub fixture { | ||||||||
|
Subroutine
fixture: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 27 | 33 | my (%params) = @_; | |||||||||
| 28 | |||||||||||
| 29 | return +{ | ||||||||||
| 30 | content_type => 'application/xml', | ||||||||||
| 31 | content_length => length $params{with_response_data}, | ||||||||||
| 32 | 33 | response_code => HTTP::Status::HTTP_OK, | |||||||||
| 33 | |||||||||||
| 34 | %params, | ||||||||||
| 35 | }; | ||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 86 | ▶ | sub error_fixture { | ||||||||
|
Subroutine
error_fixture: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 39 | 86 | my ($error_code, $http_status, $error_message) = @_; | |||||||||
| 40 | |||||||||||
| 41 | 86 | ▶ | unless (defined $error_message) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 85 | $error_message = $error_code; | |||||||||
| 43 | 85 | $error_message =~ s/ (?<=[[:lower:]]) ([[:upper:]])/ \L$1\E/gx; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 86 | return response_fixture ( | |||||||||
| 47 | response_code => $http_status, | ||||||||||
| 48 | content => <<"XML", | ||||||||||
| 49 | <?xml version="1.0" encoding="UTF-8"?> | ||||||||||
| 50 | <Error> | ||||||||||
| 51 | <Code>$error_code</Code> | ||||||||||
| 52 | <Message>$error_message error message</Message> | ||||||||||
| 53 | <Resource>/some-resource</Resource> | ||||||||||
| 54 | <RequestId>4442587FB7D0A2F9</RequestId> | ||||||||||
| 55 | </Error> | ||||||||||
| 56 | XML | ||||||||||
| 57 | ); | ||||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 40 | 1; | |||||||||
| 61 | |||||||||||
| 62 | __END__ | ||||||||||