Tests now pass with local authentication
This is the first step of a multi-step SaaS engine extraction. Looking ahead to an open source release, we need to make sure that local authentication is treated as an "official" option, and not just a hack I added for Kevin to do load testing outside our DC. So this PR gets to green, and adds a CI step in "local authentication" mode. This all probably feels a little hacky to you, Reader, but the goal of this change is to ease the next step, which will be extracting the 37id and Queenbee integrations into a proprietary "SaaS mode" engine. In service of that goal, this commit simply wraps all of the dependent code and tests with a conditional check on `config.x.local_authentication`.
This commit is contained in:
@@ -1,36 +1,34 @@
|
||||
require "test_helper"
|
||||
|
||||
class ControllerAuthenticationTest < ActionDispatch::IntegrationTest
|
||||
test "access without an account slug redirects to launchpad" do
|
||||
integration_session.default_url_options[:script_name] = "" # no tenant
|
||||
if Rails.application.config.x.local_authentication
|
||||
test "access without an account slug redirects to new session" do
|
||||
integration_session.default_url_options[:script_name] = "" # no tenant
|
||||
|
||||
get cards_path
|
||||
|
||||
assert_redirected_to Launchpad.login_url(product: true)
|
||||
end
|
||||
|
||||
test "access with an account slug but no session redirects to launchpad" do
|
||||
get cards_path
|
||||
|
||||
assert_redirected_to Launchpad.login_url(product: true, account: Account.sole)
|
||||
end
|
||||
|
||||
test "local auth, access without an account slug redirects to launchpad" do
|
||||
integration_session.default_url_options[:script_name] = "" # no tenant
|
||||
|
||||
with_local_auth do
|
||||
get cards_path
|
||||
|
||||
assert_redirected_to new_session_path
|
||||
end
|
||||
|
||||
assert_redirected_to Launchpad.login_url(product: true)
|
||||
end
|
||||
|
||||
test "local auth, access with an account slug but no session redirects to new session" do
|
||||
with_local_auth do
|
||||
test "access with an account slug but no session redirects to new session" do
|
||||
get cards_path
|
||||
|
||||
assert_redirected_to new_session_path
|
||||
end
|
||||
else
|
||||
test "access without an account slug redirects to launchpad" do
|
||||
integration_session.default_url_options[:script_name] = "" # no tenant
|
||||
|
||||
get cards_path
|
||||
|
||||
assert_redirected_to Launchpad.login_url(product: true)
|
||||
end
|
||||
|
||||
assert_redirected_to new_session_path
|
||||
test "access with an account slug but no session redirects to launchpad" do
|
||||
get cards_path
|
||||
|
||||
assert_redirected_to Launchpad.login_url(product: true, account: Account.sole)
|
||||
end
|
||||
end
|
||||
|
||||
test "access with an account slug and a session allows functional access" do
|
||||
|
||||
Reference in New Issue
Block a user