Skip to content

Commit

Permalink
Adjusting a test to pass even whether or not instance credentials are…
Browse files Browse the repository at this point in the history
… available.
  • Loading branch information
jeremeamia committed Jul 2, 2014
1 parent e70c491 commit 666ef4c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/Aws/Tests/Common/Client/ClientBuilderTest.php
Expand Up @@ -222,9 +222,17 @@ public function testAddsDefaultCredentials()
// Ensure that specific credentials can be used
$client1 = ClientBuilder::factory('Aws\\DynamoDb')->setConfig($config)->build();
$this->assertSame($creds, $client1->getCredentials());
unset($config['credentials']);

// Ensure that the instance metadata service is called when no credentials are supplied
$imc = $this->getMock(
'Aws\Common\InstanceMetadata\InstanceMetadataClient',
array('getInstanceProfileCredentials'),
array($this->getMock('Guzzle\Common\Collection'))
);
$imc->expects($this->any())->method('getInstanceProfileCredentials')
->willThrowException(new \Aws\Common\Exception\InstanceProfileCredentialsException);
unset($config['credentials']);
$config['credentials.client'] = $imc;
$client2 = ClientBuilder::factory('Aws\\DynamoDb')->setConfig($config)->build();
try {
$client2->getCredentials()->getAccessKeyId();
Expand Down

0 comments on commit 666ef4c

Please sign in to comment.