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 createAUserWithInvalidEmail(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('See an error message when providing an incorrect email'); $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); $I->sendPOST('users', ['username' => 'username', 'email' => 'testnotcorrect', 'password' => 'password', 'password_conf' => 'password']); $I->seeResponseCodeIs(400); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['status' => 'fail']); }
function obtainAuthCodeGrantRedirectsToLogin(ApiTester $I) { $client = factory(App\Models\OAuthClient::class, 1)->create(); $grant = \App\Models\OAuthGrant::find('authorization_code'); $client->oauth_grants()->attach($grant); $scope = \App\Models\OAuthScope::find('user_read'); $client->oauth_scopes()->attach($scope); $endpoint = factory(App\Models\OAuthClientEndpoint::class, 1)->make(); $endpoint->oauth_client()->associate($client); $endpoint->save(); $I->wantTo('Be redirected to login page when un authenticated user visits auth code page'); $I->amOnPage('authorize?client_id=' . $client->id . '&redirect_uri=' . $endpoint->redirect_uri . '&response_type=code&scope=user_read'); $I->seeInCurrentUrl('login'); }