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

View file

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

View file

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