#4 make sure object storage newFromIdentity worked for multiple regions.

This commit is contained in:
Matt Farina 2013-01-07 10:10:29 -05:00
parent fae05946a6
commit 921c531a29
2 changed files with 12 additions and 1 deletions

View File

@ -181,7 +181,7 @@ class ObjectStorage {
public static function newFromIdentity($identity, $region = ObjectStorage::DEFAULT_REGION) { public static function newFromIdentity($identity, $region = ObjectStorage::DEFAULT_REGION) {
$cat = $identity->serviceCatalog(); $cat = $identity->serviceCatalog();
$tok = $identity->token(); $tok = $identity->token();
return self::newFromServiceCatalog($cat, $tok); return self::newFromServiceCatalog($cat, $tok, $region);
} }
/** /**

View File

@ -100,6 +100,17 @@ class ObjectStorageTest extends \HPCloud\Tests\TestCase {
$this->assertTrue(strlen($ostore->token()) > 0); $this->assertTrue(strlen($ostore->token()) > 0);
} }
public function testNewFromIdentityAltRegion() {
$ident = $this->identity();
$ostore = \HPCloud\Storage\ObjectStorage::newFromIdentity($ident, 'region-b.geo-1');
$this->assertInstanceOf('\HPCloud\Storage\ObjectStorage', $ostore);
$this->assertTrue(strlen($ostore->token()) > 0);
// Make sure the store is not the same as the default region.
$ostoreDefault = \HPCloud\Storage\ObjectStorage::newFromIdentity($ident);
$this->assertNotEquals($ostore, $ostoreDefault);
}
/** /**
* @group auth * @group auth
* @ group acl * @ group acl