X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2bd7edf29bad74e61da31b801afd85b4c33ef7fe..849f35d1cafa1b58e55832426436689b95d69ac5:/services/api/test/unit/log_test.rb diff --git a/services/api/test/unit/log_test.rb b/services/api/test/unit/log_test.rb index fcd2b8018d..632271e98c 100644 --- a/services/api/test/unit/log_test.rb +++ b/services/api/test/unit/log_test.rb @@ -9,7 +9,7 @@ class LogTest < ActiveSupport::TestCase :destroy => [nil, :assert_not_nil, :assert_nil], } - def setup + setup do @start_time = Time.now @log_count = 1 end @@ -253,7 +253,8 @@ class LogTest < ActiveSupport::TestCase :crunchstat_for_running_job] # log & job owned by active c = Log.readable_by(users(:spectator)).order("id asc").each.to_a - assert_log_result c, known_logs, [:admin_changes_specimen, # owned by spectator + assert_log_result c, known_logs, [:noop, # object_uuid is spectator + :admin_changes_specimen, # object_uuid is a specimen owned by spectator :system_adds_baz] # readable via 'all users' group end @@ -271,10 +272,12 @@ class LogTest < ActiveSupport::TestCase end end - test "manifest_text not included in collection logs" do + test "non-empty configuration.unlogged_attributes" do Rails.configuration.unlogged_attributes = ["manifest_text"] + txt = ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n" + act_as_system_user do - coll = Collection.create(manifest_text: ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n") + coll = Collection.create(manifest_text: txt) assert_logged_with_clean_properties(coll, :create, 'manifest_text') coll.name = "testing" coll.save! @@ -283,4 +286,25 @@ class LogTest < ActiveSupport::TestCase assert_logged_with_clean_properties(coll, :destroy, 'manifest_text') end end + + test "empty configuration.unlogged_attributes" do + Rails.configuration.unlogged_attributes = [] + txt = ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n" + + act_as_system_user do + coll = Collection.create(manifest_text: txt) + assert_logged(coll, :create) do |props| + assert_equal(txt, props['new_attributes']['manifest_text']) + end + coll.update_attributes!(name: "testing") + assert_logged(coll, :update) do |props| + assert_equal(txt, props['old_attributes']['manifest_text']) + assert_equal(txt, props['new_attributes']['manifest_text']) + end + coll.destroy + assert_logged(coll, :destroy) do |props| + assert_equal(txt, props['old_attributes']['manifest_text']) + end + end + end end