Skip to content

Commit

Permalink
Merge pull request #49 from aws/s3_url_test_updates
Browse files Browse the repository at this point in the history
S3LinkTest Updates
  • Loading branch information
kstich committed Nov 16, 2017
2 parents 0187c00 + 5474dff commit 3a4a85c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/View/Helper/S3LinkTest.php
Expand Up @@ -34,23 +34,23 @@ public function setUp()
public function testGenerateSimpleLink()
{
$link = $this->viewHelper->__invoke('my-object', 'my-bucket');
$this->assertEquals('https://s3.amazonaws.com/my-bucket/my-object', $link);
$this->assertEquals('https://my-bucket.s3.amazonaws.com/my-object', $link);
}

public function testCanUseDefaultBucket()
{
$this->viewHelper->setDefaultBucket('my-default-bucket');

$link = $this->viewHelper->__invoke('my-object');
$this->assertEquals('https://s3.amazonaws.com/my-default-bucket/my-object', $link);
$this->assertEquals('https://my-default-bucket.s3.amazonaws.com/my-object', $link);
}

public function testAssertGivenBucketOverrideDefaultBucket()
{
$this->viewHelper->setDefaultBucket('my-default-bucket');

$link = $this->viewHelper->__invoke('my-object', 'my-overriden-bucket');
$this->assertEquals('https://s3.amazonaws.com/my-overriden-bucket/my-object', $link);
$this->assertEquals('https://my-overriden-bucket.s3.amazonaws.com/my-object', $link);
}

public function testCreatesUrlsForRegionalBuckets()
Expand All @@ -67,7 +67,7 @@ public function testCreatesUrlsForRegionalBuckets()
$viewHelper = new S3Link($s3Client);

$link = $viewHelper->__invoke('my-object', 'my-bucket');
$this->assertEquals('https://s3-sa-east-1.amazonaws.com/my-bucket/my-object', $link);
$this->assertEquals('https://my-bucket.s3.sa-east-1.amazonaws.com/my-object', $link);
}

/**
Expand Down Expand Up @@ -95,7 +95,7 @@ public function testGenerateSignedLink()

$url = $viewHelper->__invoke('my-object', 'my-bucket', $expires);

$this->assertStringStartsWith('https://s3-sa-east-1.amazonaws.com/my-bucket/my-object?', $url);
$this->assertStringStartsWith('https://my-bucket.s3.sa-east-1.amazonaws.com/my-object?', $url);
$this->assertContains('X-Amz-Security-Token=999', $url);
$this->assertContains('X-Amz-Content-Sha256=', $url);
$this->assertContains('X-Amz-Expires=', $url);
Expand Down

0 comments on commit 3a4a85c

Please sign in to comment.