14538: Merge branch 'master' into 14538-async-write
[arvados.git] / services / api / test / unit / api_client_authorization_test.rb
index 51a6ff3ba857821bacf831b6a08cf3804b4dc316..c390a02c04ef1ce705fa23f7a26aa2a42a93b51b 100644 (file)
@@ -3,6 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 require 'test_helper'
+require 'sweep_trashed_objects'
 
 class ApiClientAuthorizationTest < ActiveSupport::TestCase
   include CurrentApiClient
@@ -18,4 +19,11 @@ class ApiClientAuthorizationTest < ActiveSupport::TestCase
       assert_empty ApiClientAuthorization.where(api_token: newtoken), "Destroyed ApiClientAuth is still in database"
     end
   end
+
+  test "delete expired in SweepTrashedObjects" do
+    assert_not_empty ApiClientAuthorization.where(uuid: api_client_authorizations(:expired).uuid)
+    SweepTrashedObjects.sweep_now
+    assert_empty ApiClientAuthorization.where(uuid: api_client_authorizations(:expired).uuid)
+  end
+
 end