Skip to content

Commit

Permalink
Merge pull request #14397 from dkorn/alert_definitions_bulk_edit
Browse files Browse the repository at this point in the history
Add Alert Definitions (MiqAlert) bulk edits support
  • Loading branch information
abellotti committed Mar 20, 2017
2 parents 5893b80 + 511f2d1 commit 111670b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
:post:
- :name: create
:identifier: alert_definition_new
- :name: edit
:identifier: alert_definition_edit
- :name: delete
:identifier: alert_definition_delete
:resource_actions:
Expand Down
14 changes: 14 additions & 0 deletions spec/requests/api/alert_definitions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,18 @@
expect(response).to have_http_status(:ok)
expect(response.parsed_body["options"]).to eq(updated_options.deep_stringify_keys)
end

it "edits alert definitions" do
api_basic_authorize collection_action_identifier(:alert_definitions, :edit)
alert_definitions = FactoryGirl.create_list(:miq_alert, 2)
run_post(alert_definitions_url, gen_request(:edit, [{"id" => alert_definitions.first.id,
"description" => "Updated Test Alert 1"},
{"id" => alert_definitions.second.id,
"description" => "Updated Test Alert 2"}]))

expect(response).to have_http_status(:ok)
expect(response.parsed_body["results"].count).to eq(2)
expect(alert_definitions.first.reload.description).to eq("Updated Test Alert 1")
expect(alert_definitions.second.reload.description).to eq("Updated Test Alert 2")
end
end

0 comments on commit 111670b

Please sign in to comment.