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