Commit 3e7818e9 authored by Robert Schilling's avatar Robert Schilling

Grapify the issues API

parent ff02c63c
...@@ -217,22 +217,6 @@ module API ...@@ -217,22 +217,6 @@ module API
end end
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) def filter_by_iid(items, iid)
items.where(iid: iid) items.where(iid: iid)
end end
......
This diff is collapsed.
...@@ -72,13 +72,6 @@ describe API::Issues, api: true do ...@@ -72,13 +72,6 @@ describe API::Issues, api: true do
expect(json_response.last).to have_key('web_url') expect(json_response.last).to have_key('web_url')
end 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 it 'returns an array of closed issues' do
get api('/issues?state=closed', user) get api('/issues?state=closed', user)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -649,9 +642,8 @@ describe API::Issues, api: true do ...@@ -649,9 +642,8 @@ describe API::Issues, api: true do
post api("/projects/#{project.id}/issues", user), post api("/projects/#{project.id}/issues", user),
title: 'new issue', confidential: 'foo' title: 'new issue', confidential: 'foo'
expect(response).to have_http_status(201) expect(response).to have_http_status(400)
expect(json_response['title']).to eq('new issue') expect(json_response['error']).to eq('confidential is invalid')
expect(json_response['confidential']).to be_falsy
end end
it "sends notifications for subscribers of newly added labels" do it "sends notifications for subscribers of newly added labels" do
...@@ -862,8 +854,8 @@ describe API::Issues, api: true do ...@@ -862,8 +854,8 @@ describe API::Issues, api: true do
put api("/projects/#{project.id}/issues/#{confidential_issue.id}", user), put api("/projects/#{project.id}/issues/#{confidential_issue.id}", user),
confidential: 'foo' confidential: 'foo'
expect(response).to have_http_status(200) expect(response).to have_http_status(400)
expect(json_response['confidential']).to be_truthy expect(json_response['error']).to eq('confidential is invalid')
end end
end end
end end
...@@ -985,6 +977,14 @@ describe API::Issues, api: true do ...@@ -985,6 +977,14 @@ describe API::Issues, api: true do
expect(json_response['state']).to eq 'opened' expect(json_response['state']).to eq 'opened'
end end
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 end
describe '/projects/:id/issues/:issue_id/move' do describe '/projects/:id/issues/:issue_id/move' do
...@@ -1033,6 +1033,7 @@ describe API::Issues, api: true do ...@@ -1033,6 +1033,7 @@ describe API::Issues, api: true do
to_project_id: target_project.id to_project_id: target_project.id
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
expect(json_response['message']).to eq('404 Issue Not Found')
end end
end end
...@@ -1042,6 +1043,7 @@ describe API::Issues, api: true do ...@@ -1042,6 +1043,7 @@ describe API::Issues, api: true do
to_project_id: target_project.id to_project_id: target_project.id
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
expect(json_response['message']).to eq('404 Project Not Found')
end end
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