Skip to content

Commit

Permalink
test(client-s3): unit test for outpost presigned url (#3902)
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP authored Sep 29, 2021
1 parent 2072f45 commit 450587d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions test/services/s3.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2973,13 +2973,25 @@ describe('AWS.S3', function() {
});

it('supports outposts ARN', function(done) {
s3 = new AWS.S3({ region: 'us-west-2', signatureVersion: 'v4' });
helpers.spyOn(AWS.S3.prototype, 'getSkewCorrectedDate').andReturn(new Date('2021-08-27T00:00:00'));
s3.getSignedUrl('getObject', {
Bucket: 'arn:aws:s3-outposts:us-west-2:123456789012:outpost/op-01234567890123456/accesspoint/myendpoint',
Key: 'key'
}, function(err, data) {
expect(data).to.equal(
'https://myendpoint-123456789012.op-01234567890123456.s3-outposts.us-west-2.amazonaws.com/key?AWSAccessKeyId=akid&Expires=900&Signature=R9HjMWdhk69e7%2BwlOpFH1TUkxRY%3D&x-amz-security-token=session'
);
Bucket: 'arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myendpoint',
Key: 'obj'
}, function(_, data) {
expect(data).to.contain('20210827%2Fus-west-2%2Fs3-outposts%2Faws4_request');
done();
});
});

it('supports outposts ARN from resolved region', function(done) {
s3 = new AWS.S3({ region: 'us-west-2', signatureVersion: 'v4' });
helpers.spyOn(AWS.S3.prototype, 'getSkewCorrectedDate').andReturn(new Date('2021-08-27T00:00:00'));
s3.getSignedUrl('getObject', {
Bucket: 'arn:aws:s3-outposts:us-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myendpoint',
Key: 'obj'
}, function(_, data) {
expect(data).to.contain('20210827%2Fus-east-1%2Fs3-outposts%2Faws4_request');
done();
});
});
Expand Down

0 comments on commit 450587d

Please sign in to comment.