function createAUserWithMissingEmail(APITester $I) { $I->wantTo('See an error message when missing an email'); $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); $I->sendPOST('users', ['username' => 'username', 'password' => 'password', 'password_conf' => 'password']); $I->seeResponseCodeIs(400); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['status' => 'fail']); }
function updateAUserAvatar(APITester $I) { $client = factory(App\Models\OAuthClient::class, 1)->create(); $grant = \App\Models\OAuthGrant::find('password'); $client->oauth_grants()->attach($grant); $scopes = \App\Models\OAuthScope::all()->lists('id')->toArray(); $client->oauth_scopes()->attach($scopes); $I->wantTo('Update a user avatar'); }
function cantObtainClientGrantWithInvalidCredentials(APITester $I) { $client = factory(App\Models\OAuthClient::class, 1)->create(); $grant = \App\Models\OAuthGrant::find('client_credentials'); $client->oauth_grants()->attach($grant); $scope = \App\Models\OAuthScope::find('user_read'); $client->oauth_scopes()->attach($scope); $I->wantTo('Send bad client credentials and receive an error'); $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); $I->sendPOST('oauth/access_token', ['grant_type' => 'client_credentials', 'client_id' => $client->id, 'client_secret' => 'badsecret', 'scope' => 'user_read']); $I->seeResponseCodeIs(401); $I->seeResponseIsJson(); }
<?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');