BigW Consortium Gitlab

Commit 383138af by James Lopez

add issues spec and user agent details to entities

parent bb918a2f
......@@ -875,5 +875,11 @@ module API
expose :dependencies, using: Dependency
end
end
class UserAgentDetail < Grape::Entity
expose :user_agent
expose :ip_address
expose :submitted
end
end
end
......@@ -1462,6 +1462,25 @@ describe API::Issues do
end
end
describe "GET /projects/:id/issues/:issue_iid/user_agent_detail" do
let(:user_agent_detail) { create(:user_agent_detail, subject: issue) }
it 'exposes known attributes' do
get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail", admin)
expect(response).to have_http_status(200)
expect(json_response['user_agent']).to eq(user_agent_detail.user_agent)
expect(json_response['ip_address']).to eq(user_agent_detail.ip_address)
expect(json_response['submitted']).to be false
end
it "returns unautorized for non-admin users" do
get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail", user)
expect(response).to have_http_status(403)
end
end
def expect_paginated_array_response(size: nil)
expect(response).to have_http_status(200)
expect(response).to include_pagination_headers
......
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