Revision b299f9c9
Added by Dominic Cleal about 8 years ago
test/functional/api/v2/hosts_controller_test.rb | ||
---|---|---|
Host.order('id asc').last
|
||
end
|
||
|
||
def expect_attribute_modifiers(*modifier_classes)
|
||
modifier_classes.each do |modifier_class|
|
||
Host.any_instance.expects(:apply_compute_profile).once.with do |modifier|
|
||
modifier.is_a? modifier_class
|
||
end
|
||
end
|
||
def expect_attribute_modifier(modifier_class, args)
|
||
modifier = mock(modifier_class.name)
|
||
modifier_class.expects(:new).with(*args).returns(modifier)
|
||
Host.any_instance.expects(:apply_compute_profile).with(modifier)
|
||
end
|
||
|
||
test "should get index" do
|
||
... | ... | |
|
||
test "create applies attribute modifiers on the new host" do
|
||
disable_orchestration
|
||
expect_attribute_modifiers(ComputeAttributeMerge, InterfaceMerge)
|
||
expect_attribute_modifier(ComputeAttributeMerge, [])
|
||
expect_attribute_modifier(InterfaceMerge, [{:merge_compute_attributes => true}])
|
||
post :create, { :host => valid_attrs }
|
||
end
|
||
|
||
test "update applies attribute modifiers on the host" do
|
||
disable_orchestration
|
||
expect_attribute_modifiers(ComputeAttributeMerge, InterfaceMerge)
|
||
expect_attribute_modifier(ComputeAttributeMerge, [])
|
||
expect_attribute_modifier(InterfaceMerge, [{:merge_compute_attributes => true}])
|
||
put :update, { :id => @host.to_param, :host => valid_attrs }
|
||
end
|
||
|
Also available in: Unified diff
fixes #13980 - don't merge NIC compute attrs on New Host form
Removes merging of NIC's compute attributes when refreshing interfaces
on compute profile or resource selections on the New Host form. Instead,
overwrite NIC attributes from the profile (as it did before 85e82d0) as
the UI needs refreshing completely on compute profile selection.
Merging of NIC compute attributes with the compute profile is retained
on the host API where it's still valuable for supplying a partial set
of compute attributes.