-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14641 from lfu/prevent_retirement_request
Add policy checking for retirement request.
- Loading branch information
Showing
5 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
spec/lib/miq_automation_engine/engine/miq_ae_builtin_method_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe MiqAeEngine::MiqAeBuiltinMethod do | ||
describe '.miq_check_policy_prevent' do | ||
let(:event) { FactoryGirl.create(:miq_event) } | ||
let(:svc_event) { MiqAeMethodService::MiqAeServiceEventStream.find(event.id) } | ||
let(:workspace) { double('WORKSPACE', :get_obj_from_path => { 'event_stream' => svc_event }) } | ||
let(:obj) { double('OBJ', :workspace => workspace) } | ||
|
||
subject { described_class.send(:miq_check_policy_prevent, obj, {}) } | ||
|
||
it 'with policy not prevented' do | ||
expect { subject }.not_to raise_error | ||
end | ||
|
||
it 'with policy prevented' do | ||
event.update_attributes(:full_data => {:policy => {:prevented => true}}) | ||
expect { subject }.to raise_error(MiqAeException::StopInstantiation) | ||
end | ||
end | ||
end |