1 ENV["RAILS_ENV"] = "test"
2 unless ENV["NO_COVERAGE_TEST"]
7 require File.expand_path('../../config/environment', __FILE__)
8 require 'rails/test_help'
10 module ArvadosTestSupport
12 ActiveSupport::JSON.decode @response.body
15 def api_token(api_client_auth_name)
16 api_client_authorizations(api_client_auth_name).api_token
19 def auth(api_client_auth_name)
20 {'HTTP_AUTHORIZATION' => "OAuth2 #{api_token(api_client_auth_name)}"}
24 class ActiveSupport::TestCase
25 # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
27 # Note: You'll currently still have to declare fixtures explicitly in integration tests
28 # -- they do not yet inherit this setting
31 include ArvadosTestSupport
34 Thread.current[:api_client_ip_address] = nil
35 Thread.current[:api_client_authorization] = nil
36 Thread.current[:api_client_uuid] = nil
37 Thread.current[:api_client] = nil
38 Thread.current[:user] = nil
42 self.request.headers["Accept"] = "text/json"
45 def authorize_with(api_client_auth_name)
46 ArvadosApiToken.new.call ({"rack.input" => "", "HTTP_AUTHORIZATION" => "OAuth2 #{api_client_authorizations(api_client_auth_name).api_token}"})
50 class ActionDispatch::IntegrationTest
52 Thread.current[:api_client_ip_address] = nil
53 Thread.current[:api_client_authorization] = nil
54 Thread.current[:api_client_uuid] = nil
55 Thread.current[:api_client] = nil
56 Thread.current[:user] = nil
60 # Ensure permissions are computed from the test fixtures.
61 User.invalidate_permissions_cache