-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set the initiator from the workflow/request #14070
Changes from all commits
9efba3a
5f9143c
d3fe304
11cfd06
05ad19b
a7b9f88
1c171b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,28 @@ | |
end | ||
end | ||
|
||
context "initiator" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mkanoor Do we have any tests for when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gmcculloug Yes that was an issue, I fixed it |
||
shared_examples_for 'initiator example' do |initiator, match| | ||
it 'test initiator' do | ||
svc_template = FactoryGirl.create(:service_template, :name => 'Svc A') | ||
options = {:dialog => {}} | ||
options[:initiator] = initiator if initiator | ||
svc_task = instance_double("service_task", :options => options) | ||
svc = svc_template.create_service(svc_task, nil) | ||
|
||
expect(svc.initiator).to eq(match) | ||
end | ||
end | ||
|
||
context "initiator specified" do | ||
it_behaves_like 'initiator example', 'fred', 'fred' | ||
end | ||
|
||
context "initiator not specified" do | ||
it_behaves_like 'initiator example', nil, 'user' | ||
end | ||
end | ||
|
||
context "with multiple services" do | ||
before(:each) do | ||
@svc_a = FactoryGirl.create(:service_template, :name => 'Svc A') | ||
|
@@ -606,13 +628,15 @@ | |
resource_action = FactoryGirl.create(:resource_action, :action => "Provision") | ||
service_template = FactoryGirl.create(:service_template, | ||
:resource_actions => [resource_action]) | ||
hash = {:target => service_template, :initiator => 'control'} | ||
workflow = instance_double(ResourceActionWorkflow) | ||
expect(ResourceActionWorkflow).to(receive(:new) | ||
.with({}, user, resource_action, :target => service_template).and_return(workflow)) | ||
.with({}, user, resource_action, hash).and_return(workflow)) | ||
expect(workflow).to receive(:submit_request) | ||
expect(workflow).to receive(:set_value).with('ordered_by', 'fred') | ||
expect(workflow).to receive(:set_value).with(:initiator, 'control') | ||
|
||
service_template.provision_request(user, 'ordered_by' => 'fred') | ||
service_template.provision_request(user, 'ordered_by' => 'fred', :initiator => 'control') | ||
end | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gmcculloug
If the value is nil we don't set the initiator causing the default value of user to be used.