1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class LoginWorkflowTest < ActionDispatch::IntegrationTest
8 test "default prompt to login is JSON" do
9 post('/arvados/v1/collections',
10 params: {collection: {}},
11 headers: {'HTTP_ACCEPT' => ''})
13 json_response['errors'].each do |err|
14 assert(err.include?("Not logged in"), "error message '#{err}' expected to include 'Not logged in'")
18 test "login prompt respects JSON Accept header" do
19 post('/arvados/v1/collections',
20 params: {collection: {}},
21 headers: {'HTTP_ACCEPT' => 'application/json'})
23 json_response['errors'].each do |err|
24 assert(err.include?("Not logged in"), "error message '#{err}' expected to include 'Not logged in'")
28 test "login prompt respects HTML Accept header" do
29 post('/arvados/v1/collections',
30 params: {collection: {}},
31 headers: {'HTTP_ACCEPT' => 'text/html'})
33 assert_match(%r{http://www.example.com/login$}, @response.headers['Location'],
34 "HTML login prompt did not include expected redirect")