14538: Merge branch 'master' into 14538-async-write
[arvados.git] / services / api / test / unit / api_client_authorization_test.rb
index dd255fb0e0b459c32605049da94896e886776aad..c390a02c04ef1ce705fa23f7a26aa2a42a93b51b 100644 (file)
@@ -1,4 +1,9 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require 'test_helper'
+require 'sweep_trashed_objects'
 
 class ApiClientAuthorizationTest < ActiveSupport::TestCase
   include CurrentApiClient
@@ -14,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