예제 #1
0
 public function testTokenFail()
 {
     $secret = __get_test_secret();
     $secret->setPassword('hoge');
     $service = new Service(TEST_IDENTITY_ENDPOINT);
     try {
         $access = $service->tokens($secret);
     } catch (\ConoHa\Exception\HttpErrorException $ex) {
         $res = $ex->getLastResponse();
         $this->assertEquals(401, $res->getHttpCode());
         return;
     }
     $this->fail('Expect to throw HttpErrorException');
 }
예제 #2
0
 public function getIdentityService($endpoint = null)
 {
     if ($this->access instanceof Access) {
         $s = new IdentityService($endpoint);
         $s->setToken($this->access->getToken());
     } else {
         if ($endpoint != null) {
             $s = new IdentityService($endpoint);
         } else {
             throw new InvalidArgumentException('The endpoint url is required if auth() method does not called.');
         }
     }
     return $s;
 }