16826: Adds test exposing the bug.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Fri, 11 Sep 2020 21:42:04 +0000 (18:42 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Fri, 11 Sep 2020 21:42:04 +0000 (18:42 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

services/api/test/unit/application_test.rb
services/api/test/unit/log_test.rb

index 679dddf223fa72b9d89f94258f8415c75992143f..e1565ec627c42ec53bbba875d8760d7637302e8c 100644 (file)
@@ -7,7 +7,7 @@ require 'test_helper'
 class ApplicationTest < ActiveSupport::TestCase
   include CurrentApiClient
 
-  test "test act_as_system_user" do
+  test "act_as_system_user" do
     Thread.current[:user] = users(:active)
     assert_equal users(:active), Thread.current[:user]
     act_as_system_user do
@@ -17,7 +17,7 @@ class ApplicationTest < ActiveSupport::TestCase
     assert_equal users(:active), Thread.current[:user]
   end
 
-  test "test act_as_system_user is exception safe" do
+  test "act_as_system_user is exception safe" do
     Thread.current[:user] = users(:active)
     assert_equal users(:active), Thread.current[:user]
     caught = false
@@ -33,4 +33,12 @@ class ApplicationTest < ActiveSupport::TestCase
     assert caught
     assert_equal users(:active), Thread.current[:user]
   end
+
+  test "config maps' keys are returned as symbols" do
+    assert Rails.configuration.Users.AutoSetupUsernameBlacklist.is_a? ActiveSupport::OrderedOptions
+    assert Rails.configuration.Users.AutoSetupUsernameBlacklist.keys.size > 0
+    Rails.configuration.Users.AutoSetupUsernameBlacklist.keys.each do |k|
+      assert k.is_a? Symbol
+    end
+  end
 end
index 016a0e4eb4a9b6a59717de2c75a634b3182dd82f..59fe3624d842d73055cf26e227512c8a79047f97 100644 (file)
@@ -282,7 +282,9 @@ class LogTest < ActiveSupport::TestCase
   end
 
   test "non-empty configuration.unlogged_attributes" do
-    Rails.configuration.AuditLogs.UnloggedAttributes = {"manifest_text"=>{}}
+    conf = ActiveSupport::OrderedOptions.new
+    conf["manifest_text"] = {}
+    Rails.configuration.AuditLogs.UnloggedAttributes = conf
     txt = ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n"
 
     act_as_system_user do
@@ -297,7 +299,7 @@ class LogTest < ActiveSupport::TestCase
   end
 
   test "empty configuration.unlogged_attributes" do
-    Rails.configuration.AuditLogs.UnloggedAttributes = {}
+    Rails.configuration.AuditLogs.UnloggedAttributes = ActiveSupport::OrderedOptions.new
     txt = ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n"
 
     act_as_system_user do