Skip to content

Commit

Permalink
Added unit test of autorefresh token feature
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianmoya committed Jan 19, 2012
1 parent 9d96e81 commit 8178336
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Tests/IdentityAuth/IdentityAuthClientTest.php
Expand Up @@ -14,7 +14,18 @@ public function testGetToken()
$this->setMockResponse($client, 'identity_auth/AuthenticateUnauthorized');

$this->setExpectedException('Guzzle\Openstack\Common\OpenstackException');
$client->getToken('username','password');
$client->getToken('username','password');

//Check success
$this->setMockResponse($client, 'identity_auth/AuthenticateAuthorized');
$token = $client->getToken('username','password');
$this->assertEquals('admintoken', $token);

//Check autorefresh token
$this->setMockResponse($client, array('identity_auth/AuthenticateUnauthorized','identity_auth/AuthenticateAuthorized'));
$token = $client->getToken('username','password');
$this->assertEquals('admintoken', $token);

}
}
?>

0 comments on commit 8178336

Please sign in to comment.