Exemplo n.º 1
0
 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 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();
 }