Skip to content

Commit

Permalink
Prefix test for pplu#171 pplu#244
Browse files Browse the repository at this point in the history
  • Loading branch information
castaway committed Jul 4, 2018
1 parent 8480411 commit 6a77fe7
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions t/s3/prefix.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env perl

use strict;
use warnings;

use lib 't/lib';

use English qw(-no-match-vars);
use Data::Printer;
use Data::Dumper;
use Carp;
use Test::More;
use URI::Escape;

use Paws;
use TestRequestCaller;

Paws->default_config->caller(TestRequestCaller->new);
Paws->default_config->credentials('Test::CustomCredentials');

my $bucketname = 'shadowcatjesstest';
my $s3 = Paws->service('S3', region => 'us-west-2');

my %prefix_methods = (
ListObjectVersions => {
Bucket => $bucketname,
Prefix => 'TestPrefix',
},
ListObjects => {
Bucket => $bucketname,
Prefix => 'TestPrefix',
},
);

my %prefix_results = (
ListObjectVersions => 'https://s3-us-west-2.amazonaws.com/shadowcatjesstest?prefix=TestPrefix',
ListObjects => 'https://s3-us-west-2.amazonaws.com/shadowcatjesstest?prefix=TestPrefix',
);

foreach my $method (qw/ListObjectVersions ListObjects/) {
my $response;
eval { $response = $s3->$method(%{ $prefix_methods{$method} });
} or do {
warn qq[Error creating object: $@];
};

TODO: {
local $TODO = 'Remove after fixing/verifying prefix';
## The URI Query params should contain a Prefix param
is($response->url, $prefix_results{$method}, "S3 $method URI contains Prefix");
};
}

done_testing;

0 comments on commit 6a77fe7

Please sign in to comment.