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/specimens',
10 params: {specimen: {}},
11 headers: {'HTTP_ACCEPT' => ''})
13 assert_includes(json_response['errors'], "Not logged in")
16 test "login prompt respects JSON Accept header" do
17 post('/arvados/v1/specimens',
18 params: {specimen: {}},
19 headers: {'HTTP_ACCEPT' => 'application/json'})
21 assert_includes(json_response['errors'], "Not logged in")
24 test "login prompt respects HTML Accept header" do
25 post('/arvados/v1/specimens',
26 params: {specimen: {}},
27 headers: {'HTTP_ACCEPT' => 'text/html'})
29 assert_match(%r{/auth/joshid$}, @response.headers['Location'],
30 "HTML login prompt did not include expected redirect")