/** * @test * @@vcr info_status */ public function get_status() { VCR::turnOn(); //VCR::insertCassette('authenticate'); VCR::insertCassette('info_status'); //Arrange $sauce_api = new Client(); //Act $who = $sauce_api->api('provider_information')->status(); //Assert $this->assertArrayHasKey('service_operational', $who); // To stop recording requests, eject the cassette VCR::eject(); // Turn off VCR to stop intercepting requests VCR::turnOff(); }
/** * @test * @@vcr show_activity */ public function should_get_activity() { VCR::turnOn(); //VCR::insertCassette('authenticate'); VCR::insertCassette('show_activity'); //Arrange $sauce_api = new Client(); $sauce_api->authenticate($_ENV['USERNAME_KEY'], $_ENV['TOKEN_PASSWORD'], Client::AUTH_HTTP_PASSWORD); //Act $what = $sauce_api->api('current_user')->getUserActivity($_ENV['USERNAME_KEY']); //Assert $this->assertArrayHasKey('subaccounts', $what); // To stop recording requests, eject the cassette VCR::eject(); // Turn off VCR to stop intercepting requests VCR::turnOff(); }
/** * @test * @vcr job_asset_download_video */ public function jobDownLoadVideo() { $username = $_ENV['USERNAME_KEY']; VCR::turnOn(); //VCR::insertCassette('authenticate'); VCR::insertCassette('job_asset_download_video'); //Arrange $sauce_api = new Client(); $sauce_api->authenticate($username, $_ENV['TOKEN_PASSWORD'], Client::AUTH_HTTP_PASSWORD); //Act $jobId = '1cde7b77e8744ff5b6198489ceffce81'; $response = $sauce_api->api('assets')->downloadVideo($username, $jobId); //Assert $this->assertNotEmpty($response); // To stop recording requests, eject the cassette VCR::eject(); // Turn off VCR to stop intercepting requests VCR::turnOff(); }
/** * Send a DELETE request with JSON-encoded parameters. * * @param string $path Request path. * @param array $parameters POST parameters to be JSON encoded. * @param array $requestHeaders Request headers. */ protected function delete($path, array $parameters = array(), $requestHeaders = array()) { $response = $this->client->getHttpClient()->delete($path, $this->createJsonBody($parameters), $requestHeaders); return ResponseMediator::getContent($response); }