Beispiel #1
0
 public function boot(APITester $I)
 {
     $I->amHttpAuthenticated('admin', 'testpassword');
     $I->sendGET('/login');
     $I->seeResponseCodeIs(201);
     $json = $I->grabResponse();
     $this->token = json_decode($json)->token;
 }
Beispiel #2
0
 public function checkLogin(APITester $I)
 {
     $I->amHttpAuthenticated('admin', 'testpassword');
     $I->sendGET('/login');
     $I->seeResponseCodeIs(201);
     $I->seeResponseIsJson();
     $I->seeResponseContainsJson(['status' => 'ok']);
 }
Beispiel #3
0
 public function listFiles(APITester $I)
 {
     $I->amBearerAuthenticated($this->token);
     $I->sendGET('/files');
     $I->seeResponseCodeIs(200);
     $I->seeResponseJsonMatchesJsonPath('$.[*]');
     $I->dontSeeResponseJsonMatchesJsonPath('$.[*].*');
 }
Beispiel #4
0
 public function showUser(APITester $I)
 {
     $I->amBearerAuthenticated($this->token);
     $I->sendGET('/users/admin');
     $I->seeResponseCodeIs(200);
     $I->seeResponseJsonMatchesJsonPath('$.[*]');
     $I->seeResponseJsonMatchesJsonPath('$.username');
     $I->dontSeeResponseJsonMatchesJsonPath('$.password');
 }
Beispiel #5
0
 public function showConfig(APITester $I)
 {
     $I->amBearerAuthenticated($this->token);
     $I->sendGET('/config/site');
     $I->seeResponseCodeIs(200);
     $I->seeResponseJsonMatchesJsonPath('$.[*]');
     $I->seeResponseJsonMatchesJsonPath('$.title');
     $I->seeResponseJsonMatchesJsonPath('$.theme');
 }
Beispiel #6
0
 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');
 }
Beispiel #7
0
 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');