projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
4533: Add more tests for disabling reset feature in config file.
[arvados.git]
/
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 7909e60b0cf3089f54f35cb0559abd4f74c73185..1953aa1034169dc62aaffdea78361e810dcf934a 100644
(file)
--- a/
services/api/test/functional/database_controller_test.rb
+++ b/
services/api/test/functional/database_controller_test.rb
@@
-3,6
+3,12
@@
require 'test_helper'
class DatabaseControllerTest < ActionController::TestCase
include CurrentApiClient
class DatabaseControllerTest < ActionController::TestCase
include CurrentApiClient
+ teardown do
+ restore_configuration
+ # We made configuration changes here that affect routing.
+ Rails.application.reload_routes!
+ end
+
test "reset fails with non-admin token" do
authorize_with :active
post :reset
test "reset fails with non-admin token" do
authorize_with :active
post :reset
@@
-18,6
+24,15
@@
class DatabaseControllerTest < ActionController::TestCase
ENV['RAILS_ENV'] = env_was
end
ENV['RAILS_ENV'] = env_was
end
+ test "reset fails when not configured" do
+ Rails.configuration.enable_remote_database_reset = false
+ Rails.application.reload_routes!
+ authorize_with :admin
+ assert_raise ActionController::RoutingError do
+ post :reset
+ end
+ end
+
test "reset succeeds with admin token" do
new_uuid = nil
act_as_system_user do
test "reset succeeds with admin token" do
new_uuid = nil
act_as_system_user do