- assert_select "user", :count => 2 do
- check_xml_details(user1, true)
- assert_select "user[id='#{user2.id}']", :count => 0
- check_xml_details(user3, false)
- end
-
- get api_users_path, :params => { :users => "#{user1.id},#{user3.id}" }, :headers => bearer_authorization_header(bad_token.token)
- assert_response :success
- assert_equal "application/xml", response.media_type
- assert_select "user", :count => 2 do
- check_xml_details(user1, false)
- assert_select "user[id='#{user2.id}']", :count => 0
- check_xml_details(user3, false)
- end
-
- get api_users_path, :params => { :users => user1.id, :format => "json" }, :headers => bearer_authorization_header(good_token.token)
- assert_response :success
- assert_equal "application/json", response.media_type
- js = ActiveSupport::JSON.decode(@response.body)
- assert_not_nil js
- assert_equal 1, js["users"].count
- check_json_details(js["users"][0], user1, true)
-
- get api_users_path, :params => { :users => user2.id, :format => "json" }, :headers => bearer_authorization_header(good_token.token)
- assert_response :success
- assert_equal "application/json", response.media_type
- js = ActiveSupport::JSON.decode(@response.body)
- assert_not_nil js
- assert_equal 1, js["users"].count
- check_json_details(js["users"][0], user2, false)
-
- get api_users_path, :params => { :users => "#{user1.id},#{user3.id}", :format => "json" }, :headers => bearer_authorization_header(good_token.token)
- assert_response :success
- assert_equal "application/json", response.media_type
- js = ActiveSupport::JSON.decode(@response.body)
- assert_not_nil js
- assert_equal 2, js["users"].count
- check_json_details(js["users"][0], user1, true)
- check_json_details(js["users"][1], user3, false)
-
- get api_users_path, :params => { :users => "#{user1.id},#{user3.id}", :format => "json" }, :headers => bearer_authorization_header(bad_token.token)
- assert_response :success
- assert_equal "application/json", response.media_type
- js = ActiveSupport::JSON.decode(@response.body)
- assert_not_nil js
- assert_equal 2, js["users"].count
- check_json_details(js["users"][0], user1, false)
- check_json_details(js["users"][1], user3, false)
-
- get api_users_path, :params => { :users => create(:user, :suspended).id }, :headers => bearer_authorization_header(good_token.token)
- assert_response :not_found
-
- get api_users_path, :params => { :users => create(:user, :deleted).id }, :headers => bearer_authorization_header(good_token.token)
- assert_response :not_found
-
- get api_users_path, :params => { :users => 0 }, :headers => bearer_authorization_header(good_token.token)
- assert_response :not_found