3 class DatabaseControllerTest < ActionController::TestCase
4 include CurrentApiClient
8 # We made configuration changes here that affect routing.
9 Rails.application.reload_routes!
12 test "reset fails with non-admin token" do
13 authorize_with :active
18 test "reset fails when not in test mode" do
20 env_was = ENV['RAILS_ENV']
21 ENV['RAILS_ENV'] = 'development'
24 ENV['RAILS_ENV'] = env_was
27 test "reset fails when not configured" do
28 Rails.configuration.enable_remote_database_reset = false
29 Rails.application.reload_routes!
31 assert_raise ActionController::RoutingError do
36 test "reset succeeds with admin token" do
39 new_uuid = Specimen.create.uuid
41 assert_not_empty Specimen.where(uuid: new_uuid)
45 assert_empty Specimen.where(uuid: new_uuid)