forked from aws/aws-sdk-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an integration test for S3 and CognitoSync to ensure path's are…
… being encoded correctly when signing requests.
- Loading branch information
1 parent
009b029
commit 616b78c
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
namespace Aws\Test\Integ; | ||
|
||
use Aws\CognitoSync\Exception\CognitoSyncException; | ||
use Aws\S3\Exception\S3Exception; | ||
|
||
class SignaturePathEncodingTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
use IntegUtils; | ||
|
||
public function testCognitoSyncRequestSucceedsWithColon() | ||
{ | ||
$client = $this->getSdk()->createClient('CognitoSync'); | ||
$error = null; | ||
try { | ||
$client->describeIdentityUsage([ | ||
'IdentityId' => 'aaa:bbb', | ||
'IdentityPoolId' => 'ccc:ddd', | ||
]); | ||
} catch (CognitoSyncException $e) { | ||
$error = $e->getAwsErrorCode(); | ||
} | ||
|
||
$this->assertEquals('ResourceNotFoundException', $error); | ||
} | ||
|
||
public function testS3RequestSucceedsWithColon() | ||
{ | ||
$s3 = $this->getSdk()->createClient('S3'); | ||
$bucket = self::getResourcePrefix() . '-php-sdk-colon-test-bucket'; | ||
|
||
$s3->createBucketAsync(['Bucket' => $bucket])->then(function () use ($s3, $bucket) { | ||
return $s3->getWaiter('BucketExists', ['Bucket' => $bucket])->promise(); | ||
})->wait(); | ||
|
||
$error = null; | ||
try { | ||
$s3->getObject([ | ||
'Bucket' => $bucket, | ||
'Key' => 'aaa:bbb', | ||
]); | ||
} catch (S3Exception $e) { | ||
$error = $e->getAwsErrorCode(); | ||
} | ||
|
||
$s3->deleteBucket(['Bucket' => $bucket]); | ||
|
||
$this->assertEquals('NoSuchKey', $error); | ||
} | ||
} |