Change mock accounts credentials

The names and usernames don't follow a canonical pattern
And the emails point to a valid domain not owned by osem and not
reserved for illustration purposes

Normalize the users' names and usernames and change the domain of the
email addresses to example.com

Fix #1365
This commit is contained in:
AEtherC0r3 2017-03-18 22:43:46 +02:00 committed by Stella Rouzi
parent 5be1ad52ee
commit 9341edd9cb
3 changed files with 29 additions and 29 deletions

View file

@ -54,9 +54,9 @@ Osem::Application.configure do
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'admin admin',
email: 'admin@email.com',
username: 'admin_admin'
name: 'facebook user',
email: 'user-facebook@example.com',
username: 'user_facebook'
},
credentials: {
token: 'fb_mock_token',
@ -69,9 +69,9 @@ Osem::Application.configure do
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'simple user',
email: 'user0@email.com',
username: 'simple_user0'
name: 'google user',
email: 'user-google@example.com',
username: 'user_google'
},
credentials: {
token: 'google_mock_token',
@ -84,9 +84,9 @@ Osem::Application.configure do
provider: 'suse',
uid: 'suse-test-uid-1',
info: {
name: 'another user',
email: 'user1@email.com',
username: 'another_user'
name: 'suse user',
email: 'user-suse@example.com',
username: 'user_suse'
},
credentials: {
token: 'suse_mock_token',
@ -99,9 +99,9 @@ Osem::Application.configure do
provider: 'github',
uid: 'github-test-uid-1',
info: {
name: 'someother user',
email: 'user2@email.com',
username: 'someother_user'
name: 'github user',
email: 'user-github@example.com',
username: 'user_github'
},
credentials: {
token: 'github_mock_token',

View file

@ -18,13 +18,13 @@ feature Openid do
within('#openidlinks') do
click_link 'omniauth-google'
end
expect(flash).to eq('test-1@gmail.com signed in successfully with google')
expect(flash).to eq('test-1@example.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
end
scenario 'signs in an existing user' do
create(:user, email: 'test-participant-1@google.com')
create(:user, email: 'test-participant-1@example.com')
expected_count_openid = Openid.count + 1
expected_count_user = User.count
visit '/accounts/sign_in'
@ -33,7 +33,7 @@ feature Openid do
within('#openidlinks') do
click_link 'omniauth-google'
end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
end
@ -51,7 +51,7 @@ feature Openid do
scenario 'adds openid to existing user' do
# Sign in user
user = create(:user, email: 'test-participant-1@google.com')
user = create(:user, email: 'test-participant-1@example.com')
sign_in user
# Add openID to current user
@ -63,15 +63,15 @@ feature Openid do
within('#openidlinks') do
click_link 'omniauth-google'
end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
expect(Openid.where(email: 'test-1@gmail.com').first.nil?).to eq(false)
expect(Openid.where(email: 'test-1@example.com').first.nil?).to eq(false)
end
scenario 'signs in with openID using the same email as another associated openid' do
# Sign in user
create(:user, email: 'test-participant-1@google.com')
create(:user, email: 'test-participant-1@example.com')
expected_count_openid = Openid.count + 1
expected_count_user = User.count
visit '/accounts/sign_in'
@ -80,7 +80,7 @@ feature Openid do
within('#openidlinks') do
click_link 'omniauth-google'
end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
@ -93,11 +93,11 @@ feature Openid do
within('#openidlinks') do
click_link 'omniauth-google'
end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
expect(Openid.where(email: 'test-participant-1@google.com').first.nil?).to eq(false)
expect(Openid.where(email: 'test-1@gmail.com').first.nil?).to eq(false)
expect(Openid.where(email: 'test-participant-1@example.com').first.nil?).to eq(false)
expect(Openid.where(email: 'test-1@example.com').first.nil?).to eq(false)
# Sign in with different openID using same email (test-1@gmail.com)
sign_out
@ -109,12 +109,12 @@ feature Openid do
within('#openidlinks') do
click_link 'omniauth-facebook'
end
expect(flash).to eq('test-participant-1@google.com signed in successfully with facebook')
expect(flash).to eq('test-participant-1@example.com signed in successfully with facebook')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
last_openid = Openid.last
expect(last_openid.uid).to eq('facebook-test-uid-1')
expect(last_openid.email).to eq('test-1@gmail.com')
expect(last_openid.email).to eq('test-1@example.com')
end
end

View file

@ -14,7 +14,7 @@ module OmniauthMacros
uid: 'google-test-uid-1',
info: {
name: 'new user name',
email: 'test-1@gmail.com'
email: 'test-1@example.com'
},
credentials: {
token: 'mock_token',
@ -30,7 +30,7 @@ module OmniauthMacros
uid: 'facebook-test-uid-1',
info: {
name: 'new user fb name',
email: 'test-1@gmail.com'
email: 'test-1@example.com'
},
credentials: {
token: 'mock_token',
@ -48,7 +48,7 @@ module OmniauthMacros
uid: 'google-test-uid-participant-1',
info: {
name: 'existing user participant name',
email: 'test-participant-1@google.com'
email: 'test-participant-1@example.com'
},
credentials: {
token: 'mock_token',
@ -66,7 +66,7 @@ module OmniauthMacros
uid: 'google-test-uid-admin-1',
info: {
name: 'existing user admin name',
email: 'test-admin-1@google.com'
email: 'test-admin-1@example.com'
},
credentials: {
token: 'mock_token',