diff options
author | James Lopez <james@jameslopez.es> | 2018-12-04 17:32:06 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-12-04 17:32:06 +0300 |
commit | 3223f7b05b25ab4ef14dd192416f1e872fc3d4a2 (patch) | |
tree | 664758f9c979c4da26601a085e5f739322867b47 /spec/requests | |
parent | 046226717c34a8f182dff25fc2b291cb9a01acf0 (diff) |
Update code based on feedback
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/files_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index 280950b0577..620f9f5e1d6 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -391,6 +391,24 @@ describe API::Files do expect(response).to have_gitlab_http_status(400) end + context 'with PATs' do + it 'returns 403 with `read_repository` scope' do + token = create(:personal_access_token, scopes: ['read_repository'], user: user) + + post api(route(file_path), personal_access_token: token), params + + expect(response).to have_gitlab_http_status(403) + end + + it 'returns 201 with `api` scope' do + token = create(:personal_access_token, scopes: ['api'], user: user) + + post api(route(file_path), personal_access_token: token), params + + expect(response).to have_gitlab_http_status(201) + end + end + context "when specifying an author" do it "creates a new file with the specified author" do params.merge!(author_email: author_email, author_name: author_name) |