From 26a092fbf7cb1a94b3d4c52a566b7342357e9fd5 Mon Sep 17 00:00:00 2001 From: ENT8R Date: Sat, 26 Aug 2023 13:01:05 +0200 Subject: [PATCH] Add checks to ensure that the response is empty --- test/controllers/api/users_controller_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/controllers/api/users_controller_test.rb b/test/controllers/api/users_controller_test.rb index e62f33839..aa4bf1e9d 100644 --- a/test/controllers/api/users_controller_test.rb +++ b/test/controllers/api/users_controller_test.rb @@ -420,9 +420,13 @@ module Api get api_users_path, :params => { :users => create(:user, :suspended).id } assert_response :success + assert_equal "application/xml", response.media_type + assert_select "user", :count => 0 get api_users_path, :params => { :users => create(:user, :deleted).id } assert_response :success + assert_equal "application/xml", response.media_type + assert_select "user", :count => 0 get api_users_path, :params => { :users => 0 } assert_response :success @@ -509,9 +513,13 @@ module Api signed_get api_users_path, :params => { :users => create(:user, :suspended).id }, :oauth => { :token => good_token } assert_response :success + assert_equal "application/xml", response.media_type + assert_select "user", :count => 0 signed_get api_users_path, :params => { :users => create(:user, :deleted).id }, :oauth => { :token => good_token } assert_response :success + assert_equal "application/xml", response.media_type + assert_select "user", :count => 0 signed_get api_users_path, :params => { :users => 0 }, :oauth => { :token => good_token } assert_response :success @@ -598,9 +606,13 @@ module Api get api_users_path, :params => { :users => create(:user, :suspended).id }, :headers => bearer_authorization_header(good_token.token) assert_response :success + assert_equal "application/xml", response.media_type + assert_select "user", :count => 0 get api_users_path, :params => { :users => create(:user, :deleted).id }, :headers => bearer_authorization_header(good_token.token) assert_response :success + assert_equal "application/xml", response.media_type + assert_select "user", :count => 0 get api_users_path, :params => { :users => 0 }, :headers => bearer_authorization_header(good_token.token) assert_response :success -- 2.39.5