mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Add helper to disable 2FA stage redirects
Many specs depend on not redirecting to 2FA, so provide a helper to skip that stage
This commit is contained in:
@@ -33,7 +33,9 @@ RSpec.configure do |c|
|
||||
c.include OpenIDConnectSpecHelpers
|
||||
end
|
||||
|
||||
describe 'OpenID Connect', type: :rails_request do
|
||||
describe 'OpenID Connect',
|
||||
skip_2fa_stage: true, # Prevent redirects to 2FA stage
|
||||
type: :rails_request do
|
||||
let(:host) { OmniAuth::OpenIDConnect::Heroku.new('foo', {}).host }
|
||||
let(:user_info) do
|
||||
{
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe AccountController, type: :controller do
|
||||
describe AccountController,
|
||||
skip_2fa_stage: true, # Prevent redirects to 2FA stage
|
||||
type: :controller do
|
||||
class UserHook < OpenProject::Hook::ViewListener
|
||||
attr_reader :registered_user, :first_login_user
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe MyController, type: :controller do
|
||||
describe MyController,
|
||||
skip_2fa_stage: true, # Prevent redirects to 2FA stage
|
||||
type: :controller do
|
||||
render_views
|
||||
|
||||
let(:sso_config) do
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
require 'spec_helper'
|
||||
|
||||
# Concern is included into AccountController and depends on methods available there
|
||||
describe AccountController, type: :controller do
|
||||
describe AccountController,
|
||||
skip_2fa_stage: true, # Prevent redirects to 2FA stage
|
||||
type: :controller do
|
||||
let(:omniauth_strategy) { double('Google Strategy', name: 'google') }
|
||||
let(:omniauth_hash) do
|
||||
OmniAuth::AuthHash.new(
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Authentication Stages', type: :feature do
|
||||
describe 'Authentication Stages',
|
||||
skip_2fa_stage: true, # Prevent redirects to 2FA stage
|
||||
type: :feature do
|
||||
before do
|
||||
@capybara_ignore_elements = Capybara.ignore_hidden_elements
|
||||
Capybara.ignore_hidden_elements = true
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe AuthSourceSSO,
|
||||
skip_2fa_stage: true, # Prevent redirects to 2FA stage
|
||||
type: :rails_request do
|
||||
let(:sso_config) do
|
||||
{
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2022 the OpenProject GmbH
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License version 3.
|
||||
#
|
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
# Copyright (C) 2010-2013 the ChiliProject Team
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.before do |example|
|
||||
if example.metadata[:skip_2fa_stage]
|
||||
allow(::OpenProject::TwoFactorAuthentication::TokenStrategyManager)
|
||||
.to receive(:enabled?)
|
||||
.and_return false
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user