public function boot(APITester $I) { $I->amHttpAuthenticated('admin', 'testpassword'); $I->sendGET('/login'); $I->seeResponseCodeIs(201); $json = $I->grabResponse(); $this->token = json_decode($json)->token; }
public function checkLogin(APITester $I) { $I->amHttpAuthenticated('admin', 'testpassword'); $I->sendGET('/login'); $I->seeResponseCodeIs(201); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['status' => 'ok']); }
public function listFiles(APITester $I) { $I->amBearerAuthenticated($this->token); $I->sendGET('/files'); $I->seeResponseCodeIs(200); $I->seeResponseJsonMatchesJsonPath('$.[*]'); $I->dontSeeResponseJsonMatchesJsonPath('$.[*].*'); }
public function showUser(APITester $I) { $I->amBearerAuthenticated($this->token); $I->sendGET('/users/admin'); $I->seeResponseCodeIs(200); $I->seeResponseJsonMatchesJsonPath('$.[*]'); $I->seeResponseJsonMatchesJsonPath('$.username'); $I->dontSeeResponseJsonMatchesJsonPath('$.password'); }
public function showConfig(APITester $I) { $I->amBearerAuthenticated($this->token); $I->sendGET('/config/site'); $I->seeResponseCodeIs(200); $I->seeResponseJsonMatchesJsonPath('$.[*]'); $I->seeResponseJsonMatchesJsonPath('$.title'); $I->seeResponseJsonMatchesJsonPath('$.theme'); }
public function indexPages(APITester $I) { $I->sendGET('/pages'); $I->seeResponseCodeIs(200); // Should be deeper than an array $I->seeResponseJsonMatchesJsonPath('$.[*]'); $I->seeResponseJsonMatchesJsonPath('$.[*].*'); $I->seeResponseJsonMatchesJsonPath('$.[0].slug'); $I->seeResponseJsonMatchesJsonPath('$.[0].title'); }
public function showTheme(APITester $I) { $I->amBearerAuthenticated($this->token); $I->sendGET('/themes/galaxy'); $I->seeResponseCodeIs(200); $I->seeResponseJsonMatchesJsonPath('$.[*]'); $I->seeResponseJsonMatchesJsonPath('$.name'); $I->seeResponseJsonMatchesJsonPath('$.layouts.[*]'); $I->seeResponseJsonMatchesJsonPath('$.infos.[*]'); $I->dontSeeResponseJsonMatchesJsonPath('$.layouts.[*].[*]'); }
<?php $I = new APITester($scenario); $I->wantTo('Test if SAP is online'); $I->sendGET('http://sap.prefeitura.unicamp.br/sap/pesquisa_achados_perdidos.jsf'); $I->seeResponseCodeIs(200); $I->seeHttpHeader('Set-Cookie'); $cookie = $I->grabHttpHeader('Set-Cookie'); $I->assertContains("JSESSIONID", $cookie); $I->seeResponseContains('javax.faces.ViewState');