1 require 'integration_helper'
3 class LoginsTest < ActionDispatch::IntegrationTest
4 test "login with api_token works after redirect" do
5 visit page_with_token('active_trustedclient')
6 assert page.has_text?('Recent jobs'), "Missing 'Recent jobs' from page"
7 assert_no_match(/\bapi_token=/, current_path)
10 test "trying to use expired token redirects to login page" do
11 visit page_with_token('expired_trustedclient')
12 buttons = all("a.btn", text: /Log in/)
13 assert_equal(1, buttons.size, "Failed to find one login button")
14 login_link = buttons.first[:href]
15 assert_match(%r{//[^/]+/login}, login_link)
16 assert_no_match(/\bapi_token=/, login_link)