Revision c95aebfb
Added by Joseph Magen about 10 years ago
test/functional/api/v2/puppetclasses_controller_test.rb | ||
---|---|---|
assert_response :success
|
||
puppetclasses = ActiveSupport::JSON.decode(@response.body)
|
||
assert !puppetclasses.empty?
|
||
assert puppetclasses['results'].kind_of?(Hash)
|
||
end
|
||
|
||
test "should get index with style=list" do
|
||
get :index, {:style => 'list' }
|
||
assert_response :success
|
||
puppetclasses = ActiveSupport::JSON.decode(@response.body)
|
||
assert !puppetclasses.empty?
|
||
assert puppetclasses['results'].kind_of?(Array)
|
||
end
|
||
|
||
test "should create puppetclass" do
|
||
... | ... | |
get :show, { :host_id => hosts(:one).to_param, :id => puppetclasses(:one).id }
|
||
assert_response :success
|
||
show_response = ActiveSupport::JSON.decode(@response.body)
|
||
assert !show_response.empty?
|
||
refute_empty show_response
|
||
end
|
||
|
||
test "should show puppetclass for hostgroup" do
|
||
... | ... | |
get :show, { :environment_id => environments(:production), :id => puppetclasses(:one).id }
|
||
assert_response :success
|
||
show_response = ActiveSupport::JSON.decode(@response.body)
|
||
assert !show_response.empty?
|
||
refute_empty show_response
|
||
end
|
||
|
||
# CRUD actions - same test as V1
|
||
... | ... | |
get :index, { }
|
||
assert_response :success
|
||
puppetclasses = ActiveSupport::JSON.decode(@response.body)
|
||
assert !puppetclasses.empty?
|
||
refute_empty puppetclasses
|
||
end
|
||
|
||
# FYI - show puppetclass doesn't work in V1
|
||
... | ... | |
get :show, { :id => puppetclasses(:one).to_param }
|
||
assert_response :success
|
||
show_response = ActiveSupport::JSON.decode(@response.body)
|
||
assert !show_response.empty?
|
||
refute_empty show_response
|
||
end
|
||
|
||
test "should create puppetclass" do
|
||
... | ... | |
assert_response :success
|
||
end
|
||
|
||
end
|
||
end
|
Also available in: Unified diff
fixes #4863 - API V2 - add puppetclasses format style=list and module_name to base.json.rabl