X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d99ef829ba0fce58c3ba928ad2a2aefeb7f9a0ac..35658af99f09f2f6768583d65246429f789fc5a2:/services/api/test/functional/database_controller_test.rb diff --git a/services/api/test/functional/database_controller_test.rb b/services/api/test/functional/database_controller_test.rb index 7909e60b0c..ef1d0c6d05 100644 --- a/services/api/test/functional/database_controller_test.rb +++ b/services/api/test/functional/database_controller_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' class DatabaseControllerTest < ActionController::TestCase @@ -9,13 +13,28 @@ class DatabaseControllerTest < ActionController::TestCase assert_response 403 end - test "reset fails when not in test mode" do + test "route not found when not in test mode" do + authorize_with :admin + env_was = Rails.env + begin + Rails.env = 'production' + Rails.application.reload_routes! + assert_raises ActionController::UrlGenerationError do + post :reset + end + ensure + Rails.env = env_was + Rails.application.reload_routes! + end + end + + test "reset fails when a non-test-fixture user exists" do + act_as_system_user do + User.create!(uuid: 'abcde-tpzed-123451234512345', email: 'bar@example.net') + end authorize_with :admin - env_was = ENV['RAILS_ENV'] - ENV['RAILS_ENV'] = 'development' post :reset assert_response 403 - ENV['RAILS_ENV'] = env_was end test "reset succeeds with admin token" do