21304: Add a test
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 2 Feb 2024 21:41:44 +0000 (16:41 -0500)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 2 Feb 2024 21:41:44 +0000 (16:41 -0500)
Confirmed this fails on main and passes on this branch

Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

services/api/test/functional/arvados/v1/users_controller_test.rb

index 07e0b71d86098877da212a2d7eefc0087204d25e..cc0b5e1320988b1098f698528fb6e892f4b11ea1 100644 (file)
@@ -1101,6 +1101,37 @@ The Arvados team.
     assert_equal(1, Log.where(object_uuid: unchanginguuid).count)
   end
 
+  test 'batch update does not produce spurious log events' do
+    # test for bug #21304
+
+    existinguuid = 'remot-tpzed-foobarbazwazqux'
+    act_as_system_user do
+      User.create!(uuid: existinguuid,
+                   first_name: 'root',
+                   is_active: true,
+                  )
+    end
+    assert_equal(1, Log.where(object_uuid: existinguuid).count)
+
+    Rails.configuration.Login.LoginCluster = 'remot'
+
+    authorize_with(:admin)
+    patch(:batch_update,
+          params: {
+            updates: {
+              existinguuid => {
+                'first_name' => 'root',
+                'email' => '',
+                'username' => '',
+                'is_active' => true,
+                'is_invited' => true
+              },
+            }})
+    assert_response(:success)
+
+    assert_equal(1, Log.where(object_uuid: existinguuid).count)
+  end
+
   NON_ADMIN_USER_DATA = ["uuid", "kind", "is_active", "is_admin", "is_invited", "email", "first_name",
                          "last_name", "username", "can_write", "can_manage"].sort