-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11137 from demarches-simplifiees/fix-10952
ETQ Instructeur avec un compte en beta.gouv.fr ou modernisation.gouv.fr je suis automatiquement redirigé vers une connexion ProConnect
- Loading branch information
Showing
5 changed files
with
73 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,16 @@ | |
expect(controller.current_user).to be(nil) | ||
end | ||
end | ||
|
||
context 'when email domain is in mandatory list' do | ||
let(:email) { '[email protected]' } | ||
it 'redirects to agent connect with force parameter' do | ||
expect(AgentConnectService).to receive(:enabled?).and_return(true) | ||
subject | ||
expect(response).to redirect_to(agent_connect_path(force_agent_connect: true)) | ||
expect(flash[:alert]).to eq("La connexion des agents passe à présent systématiquement par AgentConnect") | ||
end | ||
end | ||
end | ||
|
||
describe '#destroy' do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,28 @@ | |
expect(subject).to eq("https://agent-connect.fr/logout?id_token_hint=id_token&post_logout_redirect_uri=http%3A%2F%2Ftest.host%2Flogout") | ||
end | ||
end | ||
|
||
describe '.email_domain_is_in_mandatory_list?' do | ||
subject { described_class.email_domain_is_in_mandatory_list?(email) } | ||
|
||
context 'when email domain is beta.gouv.fr' do | ||
let(:email) { '[email protected]' } | ||
it { is_expected.to be true } | ||
end | ||
|
||
context 'when email domain is modernisation.gouv.fr' do | ||
let(:email) { '[email protected]' } | ||
it { is_expected.to be true } | ||
end | ||
|
||
context 'when email domain is not in the mandatory list' do | ||
let(:email) { '[email protected]' } | ||
it { is_expected.to be false } | ||
end | ||
|
||
context 'when email contains whitespace' do | ||
let(:email) { ' [email protected] ' } | ||
it { is_expected.to be true } | ||
end | ||
end | ||
end |