[ARVADOS] updated: a955d5a89402d4b68ccec2d00c1ecf7d86334875

git at public.curoverse.com git at public.curoverse.com
Wed Apr 23 13:39:20 EDT 2014


Summary of changes:
 services/api/test/test_helper.rb    |   18 ++++++++++++++++++
 services/api/test/unit/user_test.rb |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)

       via  a955d5a89402d4b68ccec2d00c1ecf7d86334875 (commit)
      from  1059fd1f9e22ebcae51413d2b0fde0416c71c79b (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 a955d5a89402d4b68ccec2d00c1ecf7d86334875
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Wed Apr 23 13:36:16 2014 -0400

    Added teardown to all tests which resets Thread.current[:user] and friends to
    nil.  Fixed one faulty test that turned up as a result of this change.

diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index a81bfdf..a4c1445 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -9,6 +9,14 @@ class ActiveSupport::TestCase
   # -- they do not yet inherit this setting
   fixtures :all
 
+  teardown do
+    Thread.current[:api_client_ip_address] = nil
+    Thread.current[:api_client_authorization] = nil
+    Thread.current[:api_client_uuid] = nil
+    Thread.current[:api_client] = nil
+    Thread.current[:user] = nil
+  end
+
   def expect_json
     self.request.headers["Accept"] = "text/json"
   end
@@ -21,9 +29,19 @@ class ActiveSupport::TestCase
 end
 
 class ActionDispatch::IntegrationTest
+
+  teardown do
+    Thread.current[:api_client_ip_address] = nil
+    Thread.current[:api_client_authorization] = nil
+    Thread.current[:api_client_uuid] = nil
+    Thread.current[:api_client] = nil
+    Thread.current[:user] = nil
+  end
+
   def jresponse
     @jresponse ||= ActiveSupport::JSON.decode @response.body
   end
+
   def auth auth_fixture
     {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(auth_fixture).api_token}"}
   end
diff --git a/services/api/test/unit/user_test.rb b/services/api/test/unit/user_test.rb
index fd56a74..2d2db16 100644
--- a/services/api/test/unit/user_test.rb
+++ b/services/api/test/unit/user_test.rb
@@ -88,6 +88,8 @@ class UserTest < ActiveSupport::TestCase
   end
 
   test "full name should not contain spurious whitespace" do
+    Thread.current[:user] = @admin_user   # set admin user as the current user
+
     user = User.create ({uuid: 'zzzzz-tpzed-abcdefghijklmno', email: 'foo at example.com' })
 
     assert_equal '', user.full_name

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list