Project

General

Profile

« Previous | Next » 

Revision d4dff460

Added by Joseph Magen about 10 years ago

fixes #5506 - added scoped search to SmartProxy for UI and API v2

(cherry picked from commit 428b1cfb6f6e19294756078ee70d862a36a566de)

View differences:

test/functional/api/v2/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
test "should get index filtered by feature" do
get :index, { :search => "feature=TFTP" }
assert_response :success
assert_not_nil assigns(:smart_proxies)
refute_empty assigns(:smart_proxies)
smart_proxies = ActiveSupport::JSON.decode(@response.body)
assert !smart_proxies.empty?
refute_empty smart_proxies
returned_proxy_ids = smart_proxies['results'].map { |p| p["id"] }
expected_proxy_ids = SmartProxy.with_features("TFTP").map { |p| p.id }
assert returned_proxy_ids == expected_proxy_ids
assert_equal expected_proxy_ids, returned_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
test "should get index filtered by name" do
get :index, { :search => "name=\"TFTP Proxy\"" }
assert_response :success
refute_empty assigns(:smart_proxies)
smart_proxies = ActiveSupport::JSON.decode(@response.body)
refute_empty smart_proxies
returned_proxy_ids = smart_proxies['results'].map { |p| p["id"] }
expected_proxy_ids = SmartProxy.with_features("TFTP").map { |p| p.id }
assert_equal expected_proxy_ids, returned_proxy_ids
end
test "should show individual record" do

Also available in: Unified diff