Project

General

Profile

« Previous | Next » 

Revision 4651d51f

Added by Tomáš Strachota over 11 years ago

  • ID 4651d51f64bdb50fe10ac7d4b11a1f704db9e6db

smart proxies api - filtering by proxy type

View differences:

test/functional/api/v1/smart_proxies_controller_test.rb
assert !smart_proxies.empty?
end
test "should get index filtered by type" do
as_user :admin do
get :index, { :type => 'tftp' }
end
assert_response :success
assert_not_nil assigns(:smart_proxies)
smart_proxies = ActiveSupport::JSON.decode(@response.body)
assert !smart_proxies.empty?
returned_proxy_ids = smart_proxies.map {|p| p["smart_proxy"]["id"]}
expected_proxy_ids = SmartProxy.tftp_proxies.map {|p| p.id}
assert returned_proxy_ids == expected_proxy_ids
end
test "index should fail with invalid type filter" do
as_user :admin do
get :index, { :type => 'unknown_type' }
end
assert_response :error
end
test "should show individual record" do
as_user :admin do
get :show, { :id => smart_proxies(:one).to_param }

Also available in: Unified diff