[ARVADOS] updated: 057f835f3c2f28fcaad3baebe9c279a9d6548731

git at public.curoverse.com git at public.curoverse.com
Thu May 29 16:48:48 EDT 2014


Summary of changes:
 services/api/lib/has_uuid.rb                            |  6 ++++--
 services/api/test/unit/api_client_authorization_test.rb | 16 +++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)

       via  057f835f3c2f28fcaad3baebe9c279a9d6548731 (commit)
      from  3d869c8fd045305bd1933f03f72da153dfd985af (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 057f835f3c2f28fcaad3baebe9c279a9d6548731
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu May 29 16:48:30 2014 -0400

    2762: Do not try to auto-destroy referring links when destroying a model with no uuid. refs #2762

diff --git a/services/api/lib/has_uuid.rb b/services/api/lib/has_uuid.rb
index 3bd330e..481d27a 100644
--- a/services/api/lib/has_uuid.rb
+++ b/services/api/lib/has_uuid.rb
@@ -36,7 +36,9 @@ module HasUuid
   end
 
   def destroy_permission_links
-    Link.destroy_all(['link_class=? and (head_uuid=? or tail_uuid=?)',
-                      'permission', uuid, uuid])
+    if uuid
+      Link.destroy_all(['link_class=? and (head_uuid=? or tail_uuid=?)',
+                        'permission', uuid, uuid])
+    end
   end
 end
diff --git a/services/api/test/unit/api_client_authorization_test.rb b/services/api/test/unit/api_client_authorization_test.rb
index b5b07d1..dd255fb 100644
--- a/services/api/test/unit/api_client_authorization_test.rb
+++ b/services/api/test/unit/api_client_authorization_test.rb
@@ -1,7 +1,17 @@
 require 'test_helper'
 
 class ApiClientAuthorizationTest < ActiveSupport::TestCase
-  # test "the truth" do
-  #   assert true
-  # end
+  include CurrentApiClient
+
+  [:admin_trustedclient, :active_trustedclient].each do |token|
+    test "ApiClientAuthorization can be created then deleted by #{token}" do
+      set_user_from_auth token
+      x = ApiClientAuthorization.create!(user_id: current_user.id,
+                                         api_client_id: 0,
+                                         scopes: [])
+      newtoken = x.api_token
+      assert x.destroy, "Failed to destroy new ApiClientAuth"
+      assert_empty ApiClientAuthorization.where(api_token: newtoken), "Destroyed ApiClientAuth is still in database"
+    end
+  end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list