lib/gds-sso/warden_config.rb in gds-sso-0.5.2 vs lib/gds-sso/warden_config.rb in gds-sso-0.5.3
- old
+ new
@@ -87,10 +87,14 @@
Rails.logger.warn("Authenticating with mock_gds_sso strategy")
test_user = GDS::SSO.test_user || GDS::SSO::Config.user_klass.first
if test_user
success!(test_user)
else
- raise "GDS-SSO running in mock mode and no test user found. Normally we'd load the first user in the database. Create a user in the database."
+ if Rails.env.test? and ENV['GDS_SSO_MOCK_INVALID'] == '1'
+ fail!(:invalid)
+ else
+ raise "GDS-SSO running in mock mode and no test user found. Normally we'd load the first user in the database. Create a user in the database."
+ end
end
end
end
Warden::Strategies.add(:mock_gds_sso_api_access) do