X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0662b235357dd40b5d27efd06b60044ddcec06f6..9d223ac56644eb23cdc39c5044f4fb12cf29b685:/apps/workbench/test/controllers/application_controller_test.rb diff --git a/apps/workbench/test/controllers/application_controller_test.rb b/apps/workbench/test/controllers/application_controller_test.rb index ef2a989427..d38e88f2a6 100644 --- a/apps/workbench/test/controllers/application_controller_test.rb +++ b/apps/workbench/test/controllers/application_controller_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' class ApplicationControllerTest < ActionController::TestCase @@ -334,6 +338,30 @@ class ApplicationControllerTest < ActionController::TestCase assert_response 404 end + test "requesting to the API server includes client_session_id param" do + got_query = nil + stub_api_calls + stub_api_client.stubs(:post).with do |url, query, opts={}| + got_query = query + true + end.returns fake_api_response('{}', 200, {}) + + Rails.configuration.anonymous_user_token = + api_fixture("api_client_authorizations", "anonymous", "api_token") + @controller = ProjectsController.new + test_uuid = "zzzzz-j7d0g-zzzzzzzzzzzzzzz" + get(:show, {id: test_uuid}) + + assert_includes got_query, 'current_request_id' + assert_match /\d{10}-\d{9}/, got_query['current_request_id'] + end + + test "current_request_id is nil after a request" do + @controller = NodesController.new + get(:index, {}, session_for(:active)) + assert_nil Thread.current[:current_request_id] + end + [".navbar .login-menu a", ".navbar .login-menu .dropdown-menu a" ].each do |css_selector| @@ -384,7 +412,7 @@ class ApplicationControllerTest < ActionController::TestCase [ProjectsController.new, api_fixture('groups')['anonymously_accessible_project']], [ProjectsController.new, api_fixture('groups')['anonymously_accessible_project'], false], ].each do |controller, fixture, anon_config=true| - test "#{controller} show method with anonymous config enabled" do + test "#{controller} show method with anonymous config #{anon_config ? '' : 'not '}enabled" do if anon_config Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token'] else