Skip to content

Commit

Permalink
Added an integration test for S3 and CognitoSync to ensure path's are…
Browse files Browse the repository at this point in the history
… being encoded correctly when signing requests.
  • Loading branch information
jeremeamia committed Jun 16, 2015
1 parent 009b029 commit 616b78c
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/Integ/SignatutePathEncodingTest.php
@@ -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);
}
}

0 comments on commit 616b78c

Please sign in to comment.