public function testExecute() { $uid = 17001; $name = 'superapp5372'; $oldApiKey = 'test_case_key-81753'; $oldSecret = 'nnn283f238h'; $appProps = array(); $keyService = Api_ServiceFactory::create('KeyService'); $domainService = Api_ServiceFactory::create('DomainService'); $localDomainId = $domainService->getNativeIdByName('Ringside'); $ids = $keyService->getKeyset($localDomainId, $localDomainId); $domainKey = $ids['api_key']; $this->assertNotNull($domainKey); $appService = Api_ServiceFactory::create('AppService'); $appId = $appService->createApp($name, $oldApiKey, $oldSecret, $appProps); Api_Dao_App::setAppOwner($uid, $appId); $params = array('app_api_key' => $oldApiKey); $newApiKey = '237825y235nn'; $newSecret = '328752hannafds'; $kprops = array(); $kprops[] = array('network_id' => $domainKey, 'api_key' => $newApiKey, 'secret' => $newSecret); $params = array('app_id' => $appId, 'keys' => json_encode($kprops)); $api = $this->initRest(new AdminSetAppKeys(), $params, $uid, $appId); $this->assertTrue($api->execute()); $params = array('app_api_key' => $newApiKey); $api = $this->initRest(new AdminGetAppKeys(), $params, $uid, $appId); $resp = $api->execute(); $this->assertEquals(1, count($resp['resp'])); $this->assertEquals($newApiKey, $resp['resp'][0]['api_key']); $this->assertEquals($newSecret, $resp['resp'][0]['secret']); $appService->deleteApp($appId); Api_Dao_App::removeAppOwner($uid, $appId); }
public function testExecute() { $uid = 17001; $name = 'superapp5372'; $apiKey = 'test_case_key-81753'; $secret = 'nnn283f238h'; $appProps = array(); $appService = Api_ServiceFactory::create('AppService'); $appId = $appService->createApp($name, $apiKey, $secret, $appProps); Api_Dao_App::setAppOwner($uid, $appId); $params = array('app_api_key' => $apiKey); $api = $this->initRest(new AdminGetAppKeys(), $params, $uid, $appId); $resp = $api->execute(); $this->assertEquals(1, count($resp['resp'])); $this->assertEquals($apiKey, $resp['resp'][0]['api_key']); $this->assertEquals($secret, $resp['resp'][0]['secret']); $appService->deleteApp($appId); Api_Dao_App::removeAppOwner($uid, $appId); }