Require status for updating Annotation and bump travis-core
This commit is contained in:
parent
8ce826cda0
commit
8e1b190725
|
@ -23,7 +23,7 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/travis-ci/travis-core.git
|
||||
revision: c251a6e0fa1c98723fa877a0bc4ee1d27190a12c
|
||||
revision: a5bdfab137229d4ec6b3135657596d5546ed11a6
|
||||
specs:
|
||||
travis-core (0.0.1)
|
||||
actionmailer (~> 3.2.12)
|
||||
|
|
|
@ -69,14 +69,14 @@ class Travis::Api::App
|
|||
end
|
||||
|
||||
post "/:job_id/annotations" do
|
||||
if params[:description]
|
||||
if params[:status] && params[:description]
|
||||
annotation = service(:update_annotation, params).run
|
||||
|
||||
status annotation ? 204 : 401
|
||||
else
|
||||
status 422
|
||||
|
||||
{ "error" => "Must include a description" }
|
||||
{ "error" => "Must include status and description" }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ describe 'Jobs' do
|
|||
|
||||
it "GET /jobs/:id/annotations" do
|
||||
annotation_provider = Factory(:annotation_provider)
|
||||
annotation = annotation_provider.annotations.create(job_id: job.id, description: "Foobar")
|
||||
annotation = annotation_provider.annotations.create(job_id: job.id, status: "passed", description: "Foobar")
|
||||
response = get "/jobs/#{job.id}/annotations", {}, headers
|
||||
response.should deliver_json_for(Annotation.where(id: annotation.id), version: 'v2')
|
||||
end
|
||||
|
@ -87,7 +87,7 @@ describe 'Jobs' do
|
|||
context "with valid credentials" do
|
||||
it "responds with a 204" do
|
||||
annotation_provider = Factory(:annotation_provider)
|
||||
response = post "/jobs/#{job.id}/annotations", { username: annotation_provider.api_username, key: annotation_provider.api_key, description: "Foobar" }, headers
|
||||
response = post "/jobs/#{job.id}/annotations", { username: annotation_provider.api_username, key: annotation_provider.api_key, status: "passed", description: "Foobar" }, headers
|
||||
response.status.should eq(204)
|
||||
end
|
||||
end
|
||||
|
@ -95,14 +95,22 @@ describe 'Jobs' do
|
|||
context "without a description" do
|
||||
it "responds with a 422" do
|
||||
annotation_provider = Factory(:annotation_provider)
|
||||
response = post "/jobs/#{job.id}/annotations", { username: annotation_provider.api_username, key: annotation_provider.api_key }, headers
|
||||
response = post "/jobs/#{job.id}/annotations", { username: annotation_provider.api_username, key: annotation_provider.api_key, status: "errored" }, headers
|
||||
response.status.should eq(422)
|
||||
end
|
||||
end
|
||||
|
||||
context "without a status" do
|
||||
it "responds with a 422" do
|
||||
annotation_provider = Factory(:annotation_provider)
|
||||
response = post "/jobs/#{job.id}/annotations", { username: annotation_provider.api_username, key: annotation_provider.api_key, description: "Foobar" }, headers
|
||||
response.status.should eq(422)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid credentials" do
|
||||
it "responds with a 401" do
|
||||
response = post "/jobs/#{job.id}/annotations", { username: "invalid-username", key: "invalid-key", description: "Foobar" }, headers
|
||||
response = post "/jobs/#{job.id}/annotations", { username: "invalid-username", key: "invalid-key", status: "passed", description: "Foobar" }, headers
|
||||
response.status.should eq(401)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,6 +9,6 @@ describe Travis::Api::App::Endpoint::Jobs do
|
|||
end
|
||||
|
||||
it "POST /jobs/:id/annotations" do
|
||||
response = post("/jobs/#{job.id}/annotations", { "username" => provider.api_username, "key" => provider.api_key, "description" => "Foobar" }, "HTTP_ACCEPT" => "application/vnd.travis-ci.2+json, */*; q=0.01").should be_successful
|
||||
response = post("/jobs/#{job.id}/annotations", { "username" => provider.api_username, "key" => provider.api_key, "status" => "passed", "description" => "Foobar" }, "HTTP_ACCEPT" => "application/vnd.travis-ci.2+json, */*; q=0.01").should be_successful
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user