osem-fcy/spec/support/omniauth_macros.rb
AEtherC0r3 9341edd9cb 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
2017-05-06 10:37:58 +03:00

77 lines
3.2 KiB
Ruby

module OmniauthMacros
# The mock_auth configuration allows you to set per-provider (or default)
# authentication hashes to return during integration testing.
Rails.application.secrets.google_key = 'test key google'
Rails.application.secrets.google_secret = 'test secret google'
Rails.application.secrets.facebook_key = 'test key facebook'
Rails.application.secrets.facebook_secret = 'test secret facebook'
def mock_auth_new_user
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'new user name',
email: 'test-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_new_user_fb
OmniAuth.config.mock_auth[:facebook] =
OmniAuth::AuthHash.new(
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'new user fb name',
email: 'test-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_existing_user_participant
# The mock_auth configuration allows you to set per-provider (or default)
# authentication hashes to return during integration testing.
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-participant-1',
info: {
name: 'existing user participant name',
email: 'test-participant-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_existing_user_admin
# The mock_auth configuration allows you to set per-provider (or default)
# authentication hashes to return during integration testing.
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-admin-1',
info: {
name: 'existing user admin name',
email: 'test-admin-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
end