5626: Expand test to check both positive and negative cases a bit per request.
[arvados.git] / services / api / test / functional / database_controller_test.rb
index 7909e60b0cf3089f54f35cb0559abd4f74c73185..4bda0d0f116ee5801003329d752cc241316a25f1 100644 (file)
@@ -9,13 +9,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::RoutingError 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