Revision 30105266
Added by Daniel Lobato Garcia over 8 years ago
app/controllers/api/v1/lookup_keys_controller.rb | ||
---|---|---|
|
||
def destroy
|
||
if @lookup_key.type == "PuppetclassLookupKey"
|
||
render_error 'unprocessable_entity', :status => :unprocessable_entity
|
||
render_message 'Smart class parameters cannot be destroyed',
|
||
:status => :unprocessable_entity
|
||
else
|
||
process_response @lookup_key.destroy
|
||
end
|
test/functional/api/v1/lookup_keys_controller_test.rb | ||
---|---|---|
assert_difference('LookupKey.count', 0) do
|
||
delete :destroy, { :id => lookup_keys(:one).to_param }
|
||
end
|
||
assert_response 422
|
||
assert_response :unprocessable_entity
|
||
assert_match 'Smart class parameters cannot be destroyed', @response.body
|
||
end
|
||
|
||
test "should destroy VariableLookupKey" do
|
Also available in: Unified diff
Refs #11693 - APIv1 returns message when attempting deletion of Smart class parameter