| ... | @@ -58,7 +58,7 @@ describe API::Files do |
... | @@ -58,7 +58,7 @@ describe API::Files do |
|
|
it 'returns file attributes in headers' do
|
|
it 'returns file attributes in headers' do
|
|
|
head api(route(file_path), current_user), params: params
|
|
head api(route(file_path), current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(response.headers['X-Gitlab-File-Path']).to eq(CGI.unescape(file_path))
|
|
expect(response.headers['X-Gitlab-File-Path']).to eq(CGI.unescape(file_path))
|
|
|
expect(response.headers['X-Gitlab-File-Name']).to eq('popen.rb')
|
|
expect(response.headers['X-Gitlab-File-Name']).to eq('popen.rb')
|
|
|
expect(response.headers['X-Gitlab-Last-Commit-Id']).to eq('570e7b2abdd848b95f2f578043fc23bd6f6fd24d')
|
|
expect(response.headers['X-Gitlab-Last-Commit-Id']).to eq('570e7b2abdd848b95f2f578043fc23bd6f6fd24d')
|
| ... | @@ -72,7 +72,7 @@ describe API::Files do |
... | @@ -72,7 +72,7 @@ describe API::Files do |
|
|
|
|
|
|
|
head api(route(file_path), current_user), params: params
|
|
head api(route(file_path), current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(response.headers['X-Gitlab-File-Name']).to eq('commit.js.coffee')
|
|
expect(response.headers['X-Gitlab-File-Name']).to eq('commit.js.coffee')
|
|
|
expect(response.headers['X-Gitlab-Content-Sha256']).to eq('08785f04375b47f81f46e68cc125d5ef368aa20576ddb53f91f4d83f1d04b929')
|
|
expect(response.headers['X-Gitlab-Content-Sha256']).to eq('08785f04375b47f81f46e68cc125d5ef368aa20576ddb53f91f4d83f1d04b929')
|
|
|
end
|
|
end
|
| ... | @@ -81,7 +81,7 @@ describe API::Files do |
... | @@ -81,7 +81,7 @@ describe API::Files do |
|
|
it "responds with a 400 status" do
|
|
it "responds with a 400 status" do
|
|
|
head api(route("any%2Ffile"), current_user)
|
|
head api(route("any%2Ffile"), current_user)
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -91,7 +91,7 @@ describe API::Files do |
... | @@ -91,7 +91,7 @@ describe API::Files do |
|
|
|
|
|
|
|
head api(route('app%2Fmodels%2Fapplication%2Erb'), current_user), params: params
|
|
head api(route('app%2Fmodels%2Fapplication%2Erb'), current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(404)
|
|
expect(response).to have_gitlab_http_status(:not_found)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -101,7 +101,7 @@ describe API::Files do |
... | @@ -101,7 +101,7 @@ describe API::Files do |
|
|
it "responds with a 403 status" do
|
|
it "responds with a 403 status" do
|
|
|
head api(route(file_path), current_user), params: params
|
|
head api(route(file_path), current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(403)
|
|
expect(response).to have_gitlab_http_status(:forbidden)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
| ... | @@ -119,7 +119,7 @@ describe API::Files do |
... | @@ -119,7 +119,7 @@ describe API::Files do |
|
|
|
|
|
|
|
head api(route(file_path), current_user), params: params
|
|
head api(route(file_path), current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(404)
|
|
expect(response).to have_gitlab_http_status(:not_found)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -148,7 +148,7 @@ describe API::Files do |
... | @@ -148,7 +148,7 @@ describe API::Files do |
|
|
it 'returns file attributes as json' do
|
|
it 'returns file attributes as json' do
|
|
|
get api(route(file_path), current_user), params: params
|
|
get api(route(file_path), current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(json_response['file_path']).to eq(CGI.unescape(file_path))
|
|
expect(json_response['file_path']).to eq(CGI.unescape(file_path))
|
|
|
expect(json_response['file_name']).to eq('popen.rb')
|
|
expect(json_response['file_name']).to eq('popen.rb')
|
|
|
expect(json_response['last_commit_id']).to eq('570e7b2abdd848b95f2f578043fc23bd6f6fd24d')
|
|
expect(json_response['last_commit_id']).to eq('570e7b2abdd848b95f2f578043fc23bd6f6fd24d')
|
| ... | @@ -161,7 +161,7 @@ describe API::Files do |
... | @@ -161,7 +161,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(route(file_path), current_user), params: params
|
|
get api(route(file_path), current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(response.content_type).to eq('application/json')
|
|
expect(response.content_type).to eq('application/json')
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -172,7 +172,7 @@ describe API::Files do |
... | @@ -172,7 +172,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(route(file_path), current_user), params: params
|
|
get api(route(file_path), current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(json_response['file_name']).to eq('commit.js.coffee')
|
|
expect(json_response['file_name']).to eq('commit.js.coffee')
|
|
|
expect(json_response['content_sha256']).to eq('08785f04375b47f81f46e68cc125d5ef368aa20576ddb53f91f4d83f1d04b929')
|
|
expect(json_response['content_sha256']).to eq('08785f04375b47f81f46e68cc125d5ef368aa20576ddb53f91f4d83f1d04b929')
|
|
|
expect(Base64.decode64(json_response['content']).lines.first).to eq("class Commit\n")
|
|
expect(Base64.decode64(json_response['content']).lines.first).to eq("class Commit\n")
|
| ... | @@ -184,7 +184,7 @@ describe API::Files do |
... | @@ -184,7 +184,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(url, current_user), params: params
|
|
get api(url, current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(headers[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
|
|
expect(headers[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -193,7 +193,7 @@ describe API::Files do |
... | @@ -193,7 +193,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(url, current_user), params: params
|
|
get api(url, current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'sets inline content disposition by default' do
|
|
it 'sets inline content disposition by default' do
|
| ... | @@ -294,7 +294,7 @@ describe API::Files do |
... | @@ -294,7 +294,7 @@ describe API::Files do |
|
|
it 'returns file attributes in headers' do
|
|
it 'returns file attributes in headers' do
|
|
|
head api(route(file_path) + '/blame', current_user), params: params
|
|
head api(route(file_path) + '/blame', current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(response.headers['X-Gitlab-File-Path']).to eq(CGI.unescape(file_path))
|
|
expect(response.headers['X-Gitlab-File-Path']).to eq(CGI.unescape(file_path))
|
|
|
expect(response.headers['X-Gitlab-File-Name']).to eq('popen.rb')
|
|
expect(response.headers['X-Gitlab-File-Name']).to eq('popen.rb')
|
|
|
expect(response.headers['X-Gitlab-Last-Commit-Id']).to eq('570e7b2abdd848b95f2f578043fc23bd6f6fd24d')
|
|
expect(response.headers['X-Gitlab-Last-Commit-Id']).to eq('570e7b2abdd848b95f2f578043fc23bd6f6fd24d')
|
| ... | @@ -305,7 +305,7 @@ describe API::Files do |
... | @@ -305,7 +305,7 @@ describe API::Files do |
|
|
it 'returns blame file attributes as json' do
|
|
it 'returns blame file attributes as json' do
|
|
|
get api(route(file_path) + '/blame', current_user), params: params
|
|
get api(route(file_path) + '/blame', current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(json_response.map { |x| x['lines'].size }).to eq(expected_blame_range_sizes)
|
|
expect(json_response.map { |x| x['lines'].size }).to eq(expected_blame_range_sizes)
|
|
|
expect(json_response.map { |x| x['commit']['id'] }).to eq(expected_blame_range_commit_ids)
|
|
expect(json_response.map { |x| x['commit']['id'] }).to eq(expected_blame_range_commit_ids)
|
|
|
range = json_response[0]
|
|
range = json_response[0]
|
| ... | @@ -329,7 +329,7 @@ describe API::Files do |
... | @@ -329,7 +329,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(url, current_user), params: params
|
|
get api(url, current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'returns file by commit sha' do
|
|
it 'returns file by commit sha' do
|
| ... | @@ -339,7 +339,7 @@ describe API::Files do |
... | @@ -339,7 +339,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(route(file_path) + '/blame', current_user), params: params
|
|
get api(route(file_path) + '/blame', current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
context 'when mandatory params are not given' do
|
|
context 'when mandatory params are not given' do
|
| ... | @@ -411,7 +411,7 @@ describe API::Files do |
... | @@ -411,7 +411,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(route(file_path) + '/blame', personal_access_token: token), params: params
|
|
get api(route(file_path) + '/blame', personal_access_token: token), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
| ... | @@ -424,7 +424,7 @@ describe API::Files do |
... | @@ -424,7 +424,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(url, current_user), params: params
|
|
get api(url, current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'returns raw file info for files with dots' do
|
|
it 'returns raw file info for files with dots' do
|
| ... | @@ -433,7 +433,7 @@ describe API::Files do |
... | @@ -433,7 +433,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(url, current_user), params: params
|
|
get api(url, current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'returns file by commit sha' do
|
|
it 'returns file by commit sha' do
|
| ... | @@ -444,7 +444,7 @@ describe API::Files do |
... | @@ -444,7 +444,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(route(file_path) + "/raw", current_user), params: params
|
|
get api(route(file_path) + "/raw", current_user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'sets no-cache headers' do
|
|
it 'sets no-cache headers' do
|
| ... | @@ -520,7 +520,7 @@ describe API::Files do |
... | @@ -520,7 +520,7 @@ describe API::Files do |
|
|
|
|
|
|
|
get api(route(file_path) + "/raw", personal_access_token: token), params: params
|
|
get api(route(file_path) + "/raw", personal_access_token: token), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
| ... | @@ -538,7 +538,7 @@ describe API::Files do |
... | @@ -538,7 +538,7 @@ describe API::Files do |
|
|
it "creates a new file in project repo" do
|
|
it "creates a new file in project repo" do
|
|
|
post api(route(file_path), user), params: params
|
|
post api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(201)
|
|
expect(response).to have_gitlab_http_status(:created)
|
|
|
expect(json_response["file_path"]).to eq(CGI.unescape(file_path))
|
|
expect(json_response["file_path"]).to eq(CGI.unescape(file_path))
|
|
|
last_commit = project.repository.commit.raw
|
|
last_commit = project.repository.commit.raw
|
|
|
expect(last_commit.author_email).to eq(user.email)
|
|
expect(last_commit.author_email).to eq(user.email)
|
| ... | @@ -548,7 +548,7 @@ describe API::Files do |
... | @@ -548,7 +548,7 @@ describe API::Files do |
|
|
it "returns a 400 bad request if no mandatory params given" do
|
|
it "returns a 400 bad request if no mandatory params given" do
|
|
|
post api(route("any%2Etxt"), user)
|
|
post api(route("any%2Etxt"), user)
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'returns a 400 bad request if the commit message is empty' do
|
|
it 'returns a 400 bad request if the commit message is empty' do
|
| ... | @@ -556,7 +556,7 @@ describe API::Files do |
... | @@ -556,7 +556,7 @@ describe API::Files do |
|
|
|
|
|
|
|
post api(route(file_path), user), params: params
|
|
post api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it "returns a 400 if editor fails to create file" do
|
|
it "returns a 400 if editor fails to create file" do
|
| ... | @@ -566,7 +566,7 @@ describe API::Files do |
... | @@ -566,7 +566,7 @@ describe API::Files do |
|
|
|
|
|
|
|
post api(route("any%2Etxt"), user), params: params
|
|
post api(route("any%2Etxt"), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
context 'with PATs' do
|
|
context 'with PATs' do
|
| ... | @@ -575,7 +575,7 @@ describe API::Files do |
... | @@ -575,7 +575,7 @@ describe API::Files do |
|
|
|
|
|
|
|
post api(route(file_path), personal_access_token: token), params: params
|
|
post api(route(file_path), personal_access_token: token), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(403)
|
|
expect(response).to have_gitlab_http_status(:forbidden)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'returns 201 with `api` scope' do
|
|
it 'returns 201 with `api` scope' do
|
| ... | @@ -583,7 +583,7 @@ describe API::Files do |
... | @@ -583,7 +583,7 @@ describe API::Files do |
|
|
|
|
|
|
|
post api(route(file_path), personal_access_token: token), params: params
|
|
post api(route(file_path), personal_access_token: token), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(201)
|
|
expect(response).to have_gitlab_http_status(:created)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -593,7 +593,7 @@ describe API::Files do |
... | @@ -593,7 +593,7 @@ describe API::Files do |
|
|
|
|
|
|
|
post api(route("new_file_with_author%2Etxt"), user), params: params
|
|
post api(route("new_file_with_author%2Etxt"), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(201)
|
|
expect(response).to have_gitlab_http_status(:created)
|
|
|
expect(response.content_type).to eq('application/json')
|
|
expect(response.content_type).to eq('application/json')
|
|
|
last_commit = project.repository.commit.raw
|
|
last_commit = project.repository.commit.raw
|
|
|
expect(last_commit.author_email).to eq(author_email)
|
|
expect(last_commit.author_email).to eq(author_email)
|
| ... | @@ -607,7 +607,7 @@ describe API::Files do |
... | @@ -607,7 +607,7 @@ describe API::Files do |
|
|
it "creates a new file in project repo" do
|
|
it "creates a new file in project repo" do
|
|
|
post api(route("newfile%2Erb"), user), params: params
|
|
post api(route("newfile%2Erb"), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(201)
|
|
expect(response).to have_gitlab_http_status(:created)
|
|
|
expect(json_response['file_path']).to eq('newfile.rb')
|
|
expect(json_response['file_path']).to eq('newfile.rb')
|
|
|
last_commit = project.repository.commit.raw
|
|
last_commit = project.repository.commit.raw
|
|
|
expect(last_commit.author_email).to eq(user.email)
|
|
expect(last_commit.author_email).to eq(user.email)
|
| ... | @@ -628,7 +628,7 @@ describe API::Files do |
... | @@ -628,7 +628,7 @@ describe API::Files do |
|
|
it "updates existing file in project repo" do
|
|
it "updates existing file in project repo" do
|
|
|
put api(route(file_path), user), params: params
|
|
put api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(json_response['file_path']).to eq(CGI.unescape(file_path))
|
|
expect(json_response['file_path']).to eq(CGI.unescape(file_path))
|
|
|
last_commit = project.repository.commit.raw
|
|
last_commit = project.repository.commit.raw
|
|
|
expect(last_commit.author_email).to eq(user.email)
|
|
expect(last_commit.author_email).to eq(user.email)
|
| ... | @@ -640,7 +640,7 @@ describe API::Files do |
... | @@ -640,7 +640,7 @@ describe API::Files do |
|
|
|
|
|
|
|
put api(route(file_path), user), params: params
|
|
put api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it "returns a 400 bad request if update existing file with stale last commit id" do
|
|
it "returns a 400 bad request if update existing file with stale last commit id" do
|
| ... | @@ -648,7 +648,7 @@ describe API::Files do |
... | @@ -648,7 +648,7 @@ describe API::Files do |
|
|
|
|
|
|
|
put api(route(file_path), user), params: params_with_stale_id
|
|
put api(route(file_path), user), params: params_with_stale_id
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
expect(json_response['message']).to eq(_('You are attempting to update a file that has changed since you started editing it.'))
|
|
expect(json_response['message']).to eq(_('You are attempting to update a file that has changed since you started editing it.'))
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -659,13 +659,13 @@ describe API::Files do |
... | @@ -659,13 +659,13 @@ describe API::Files do |
|
|
|
|
|
|
|
put api(route(file_path), user), params: params_with_correct_id
|
|
put api(route(file_path), user), params: params_with_correct_id
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it "returns a 400 bad request if no params given" do
|
|
it "returns a 400 bad request if no params given" do
|
|
|
put api(route(file_path), user)
|
|
put api(route(file_path), user)
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
context "when specifying an author" do
|
|
context "when specifying an author" do
|
| ... | @@ -674,7 +674,7 @@ describe API::Files do |
... | @@ -674,7 +674,7 @@ describe API::Files do |
|
|
|
|
|
|
|
put api(route(file_path), user), params: params
|
|
put api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
last_commit = project.repository.commit.raw
|
|
last_commit = project.repository.commit.raw
|
|
|
expect(last_commit.author_email).to eq(author_email)
|
|
expect(last_commit.author_email).to eq(author_email)
|
|
|
expect(last_commit.author_name).to eq(author_name)
|
|
expect(last_commit.author_name).to eq(author_name)
|
| ... | @@ -693,13 +693,13 @@ describe API::Files do |
... | @@ -693,13 +693,13 @@ describe API::Files do |
|
|
it "deletes existing file in project repo" do
|
|
it "deletes existing file in project repo" do
|
|
|
delete api(route(file_path), user), params: params
|
|
delete api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(204)
|
|
expect(response).to have_gitlab_http_status(:no_content)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it "returns a 400 bad request if no params given" do
|
|
it "returns a 400 bad request if no params given" do
|
|
|
delete api(route(file_path), user)
|
|
delete api(route(file_path), user)
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'returns a 400 bad request if the commit message is empty' do
|
|
it 'returns a 400 bad request if the commit message is empty' do
|
| ... | @@ -707,7 +707,7 @@ describe API::Files do |
... | @@ -707,7 +707,7 @@ describe API::Files do |
|
|
|
|
|
|
|
delete api(route(file_path), user), params: params
|
|
delete api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it "returns a 400 if fails to delete file" do
|
|
it "returns a 400 if fails to delete file" do
|
| ... | @@ -717,7 +717,7 @@ describe API::Files do |
... | @@ -717,7 +717,7 @@ describe API::Files do |
|
|
|
|
|
|
|
delete api(route(file_path), user), params: params
|
|
delete api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(400)
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
context "when specifying an author" do
|
|
context "when specifying an author" do
|
| ... | @@ -726,7 +726,7 @@ describe API::Files do |
... | @@ -726,7 +726,7 @@ describe API::Files do |
|
|
|
|
|
|
|
delete api(route(file_path), user), params: params
|
|
delete api(route(file_path), user), params: params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(204)
|
|
expect(response).to have_gitlab_http_status(:no_content)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
| ... | @@ -754,7 +754,7 @@ describe API::Files do |
... | @@ -754,7 +754,7 @@ describe API::Files do |
|
|
it "remains unchanged" do
|
|
it "remains unchanged" do
|
|
|
get api(route(file_path), user), params: get_params
|
|
get api(route(file_path), user), params: get_params
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
expect(json_response['file_path']).to eq(CGI.unescape(file_path))
|
|
expect(json_response['file_path']).to eq(CGI.unescape(file_path))
|
|
|
expect(json_response['file_name']).to eq(CGI.unescape(file_path))
|
|
expect(json_response['file_name']).to eq(CGI.unescape(file_path))
|
|
|
expect(json_response['content']).to eq(put_params[:content])
|
|
expect(json_response['content']).to eq(put_params[:content])
|
| ... | |
... | |
| ... | | ... | |