Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpatrick committed Apr 1, 2021
1 parent d025190 commit 7522959
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions spec/omniauth/strategies/auth0_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
expect(redirect_url).not_to have_query('prompt')
expect(redirect_url).not_to have_query('screen_hint')
expect(redirect_url).not_to have_query('login_hint')
expect(redirect_url).not_to have_query('organization')
expect(redirect_url).not_to have_query('invitation')
end

it 'redirects to hosted login page' do
Expand All @@ -109,6 +111,8 @@
expect(redirect_url).not_to have_query('prompt')
expect(redirect_url).not_to have_query('screen_hint')
expect(redirect_url).not_to have_query('login_hint')
expect(redirect_url).not_to have_query('organization')
expect(redirect_url).not_to have_query('invitation')
end

it 'redirects to the hosted login page with connection_scope' do
Expand All @@ -133,6 +137,8 @@
expect(redirect_url).not_to have_query('auth0Client')
expect(redirect_url).not_to have_query('connection')
expect(redirect_url).not_to have_query('login_hint')
expect(redirect_url).not_to have_query('organization')
expect(redirect_url).not_to have_query('invitation')
end

it 'redirects to hosted login page with screen_hint=signup' do
Expand All @@ -148,6 +154,27 @@
expect(redirect_url).not_to have_query('auth0Client')
expect(redirect_url).not_to have_query('connection')
expect(redirect_url).not_to have_query('login_hint')
expect(redirect_url).not_to have_query('organization')
expect(redirect_url).not_to have_query('invitation')
end

it 'redirects to hosted login page with organization=TestOrg and invitation=TestInvite' do
get 'auth/auth0?organization=TestOrg&invitation=TestInvite'
expect(last_response.status).to eq(302)
redirect_url = last_response.headers['Location']
expect(redirect_url).to start_with('https://samples.auth0.com/authorize')
expect(redirect_url).to have_query('response_type', 'code')
expect(redirect_url).to have_query('state')
expect(redirect_url).to have_query('client_id')
expect(redirect_url).to have_query('redirect_uri')
expect(redirect_url).to have_query('organization', 'TestOrg')
expect(redirect_url).to have_query('invitation', 'TestInvite')
expect(redirect_url).not_to have_query('auth0Client')
expect(redirect_url).not_to have_query('connection')
expect(redirect_url).not_to have_query('connection_scope')
expect(redirect_url).not_to have_query('prompt')
expect(redirect_url).not_to have_query('screen_hint')
expect(redirect_url).not_to have_query('login_hint')
end

it 'redirects to hosted login page with login_hint=example@mail.com' do
Expand All @@ -165,6 +192,8 @@
expect(redirect_url).not_to have_query('connection_scope')
expect(redirect_url).not_to have_query('prompt')
expect(redirect_url).not_to have_query('screen_hint')
expect(redirect_url).not_to have_query('organization')
expect(redirect_url).not_to have_query('invitation')
end

describe 'callback' do
Expand Down

0 comments on commit 7522959

Please sign in to comment.