Revision d575926a
Added by Alon Goldboim almost 9 years ago
test/functional/api/v2/reports_controller_test.rb | ||
---|---|---|
Resolv.any_instance.stubs(:getnames).returns(['else.where'])
|
||
post :create, {:report => create_a_puppet_transaction_report }
|
||
assert_nil @controller.detected_proxy
|
||
assert_response :success
|
||
assert_response :created
|
||
end
|
||
|
||
test 'hosts with a registered smart proxy on should create a report successfully' do
|
||
... | ... | |
Resolv.any_instance.stubs(:getnames).returns([host])
|
||
post :create, {:report => create_a_puppet_transaction_report }
|
||
assert_equal proxy, @controller.detected_proxy
|
||
assert_response :success
|
||
assert_response :created
|
||
end
|
||
|
||
test 'hosts without a registered smart proxy on should not be able to create a report' do
|
||
... | ... | |
@request.env['SSL_CLIENT_S_DN'] = 'CN=else.where'
|
||
@request.env['SSL_CLIENT_VERIFY'] = 'SUCCESS'
|
||
post :create, {:report => create_a_puppet_transaction_report }
|
||
assert_response :success
|
||
assert_response :created
|
||
end
|
||
|
||
test 'hosts without a registered smart proxy but with an SSL cert should not be able to create a report' do
|
||
... | ... | |
|
||
Resolv.any_instance.stubs(:getnames).returns(['else.where'])
|
||
post :create, {:report => create_a_puppet_transaction_report }
|
||
assert_response :success
|
||
assert_response :created
|
||
end
|
||
end
|
||
|
Also available in: Unified diff
Fixes #10356 - changed the POST/PUT RABL template to be the same as the GET template
HTTP response code standardized to 201 on create.