X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2ef803b9dfa0490d23984c326087c3a757c723e7..f3b6e0faa1cbf92b46555bea2fca62ca1895e703:/test/controllers/trace_controller_test.rb diff --git a/test/controllers/trace_controller_test.rb b/test/controllers/trace_controller_test.rb index 2dafa5394..23a2e5261 100644 --- a/test/controllers/trace_controller_test.rb +++ b/test/controllers/trace_controller_test.rb @@ -679,12 +679,22 @@ class TraceControllerTest < ActionController::TestCase post :delete, :params => { :display_name => deleted_trace_file.user.display_name, :id => deleted_trace_file.id }, :session => { :user => deleted_trace_file.user } assert_response :not_found - # Finally with a trace that we are allowed to delete + # Now with a trace that we are allowed to delete post :delete, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id }, :session => { :user => public_trace_file.user } assert_response :redirect assert_redirected_to :action => :list, :display_name => public_trace_file.user.display_name trace = Trace.find(public_trace_file.id) assert_equal false, trace.visible + + # Finally with a trace that is deleted by an admin + public_trace_file = create(:trace, :visibility => "public") + admin = create(:administrator_user) + + post :delete, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id }, :session => { :user => admin } + assert_response :redirect + assert_redirected_to :action => :list, :display_name => public_trace_file.user.display_name + trace = Trace.find(public_trace_file.id) + assert_equal false, trace.visible end # Check getting a specific trace through the api