Commit bdeafd14 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'grapify-issues-api' into 'master'

Grapify the issues API

Related to #22928

See merge request !7968
parents bf76ef8e 3e7818e9
......@@ -217,22 +217,6 @@ module API
end
end
def issuable_order_by
if params["order_by"] == 'updated_at'
'updated_at'
else
'created_at'
end
end
def issuable_sort
if params["sort"] == 'asc'
:asc
else
:desc
end
end
def filter_by_iid(items, iid)
items.where(iid: iid)
end
......
This diff is collapsed.
......@@ -72,13 +72,6 @@ describe API::Issues, api: true do
expect(json_response.last).to have_key('web_url')
end
it "adds pagination headers and keep query params" do
get api("/issues?state=closed&per_page=3", user)
expect(response.headers['Link']).to eq(
'<http://www.example.com/api/v3/issues?page=1&per_page=3&private_token=%s&state=closed>; rel="first", <http://www.example.com/api/v3/issues?page=1&per_page=3&private_token=%s&state=closed>; rel="last"' % [user.private_token, user.private_token]
)
end
it 'returns an array of closed issues' do
get api('/issues?state=closed', user)
expect(response).to have_http_status(200)
......@@ -649,9 +642,8 @@ describe API::Issues, api: true do
post api("/projects/#{project.id}/issues", user),
title: 'new issue', confidential: 'foo'
expect(response).to have_http_status(201)
expect(json_response['title']).to eq('new issue')
expect(json_response['confidential']).to be_falsy
expect(response).to have_http_status(400)
expect(json_response['error']).to eq('confidential is invalid')
end
it "sends notifications for subscribers of newly added labels" do
......@@ -862,8 +854,8 @@ describe API::Issues, api: true do
put api("/projects/#{project.id}/issues/#{confidential_issue.id}", user),
confidential: 'foo'
expect(response).to have_http_status(200)
expect(json_response['confidential']).to be_truthy
expect(response).to have_http_status(400)
expect(json_response['error']).to eq('confidential is invalid')
end
end
end
......@@ -985,6 +977,14 @@ describe API::Issues, api: true do
expect(json_response['state']).to eq 'opened'
end
end
context 'when issue does not exist' do
it 'returns 404 when trying to move an issue' do
delete api("/projects/#{project.id}/issues/123", user)
expect(response).to have_http_status(404)
end
end
end
describe '/projects/:id/issues/:issue_id/move' do
......@@ -1033,6 +1033,7 @@ describe API::Issues, api: true do
to_project_id: target_project.id
expect(response).to have_http_status(404)
expect(json_response['message']).to eq('404 Issue Not Found')
end
end
......@@ -1042,6 +1043,7 @@ describe API::Issues, api: true do
to_project_id: target_project.id
expect(response).to have_http_status(404)
expect(json_response['message']).to eq('404 Project Not Found')
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment