2014-06-18 16:58:30 +03:00
|
|
|
module OmniauthMacros
|
|
|
|
|
# The mock_auth configuration allows you to set per-provider (or default)
|
|
|
|
|
# authentication hashes to return during integration testing.
|
|
|
|
|
|
2014-06-21 07:42:02 +03:00
|
|
|
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'
|
|
|
|
|
|
2014-06-18 16:58:30 +03:00
|
|
|
def mock_auth_new_user
|
2014-06-18 18:59:01 +03:00
|
|
|
OmniAuth.config.mock_auth[:google] =
|
|
|
|
|
OmniAuth::AuthHash.new(
|
|
|
|
|
provider: 'google',
|
|
|
|
|
uid: 'google-test-uid-1',
|
|
|
|
|
info: {
|
2014-06-23 19:07:50 +03:00
|
|
|
name: 'new user name',
|
2017-03-18 22:43:46 +02:00
|
|
|
email: 'test-1@example.com'
|
2014-06-18 18:59:01 +03:00
|
|
|
},
|
|
|
|
|
credentials: {
|
|
|
|
|
token: 'mock_token',
|
|
|
|
|
secret: 'mock_secret'
|
|
|
|
|
}
|
|
|
|
|
)
|
2014-06-18 16:58:30 +03:00
|
|
|
end
|
|
|
|
|
|
2014-06-18 18:05:28 +03:00
|
|
|
def mock_auth_new_user_fb
|
2014-06-18 18:59:01 +03:00
|
|
|
OmniAuth.config.mock_auth[:facebook] =
|
|
|
|
|
OmniAuth::AuthHash.new(
|
2014-07-23 14:55:06 +02:00
|
|
|
provider: 'facebook',
|
2014-06-18 18:59:01 +03:00
|
|
|
uid: 'facebook-test-uid-1',
|
|
|
|
|
info: {
|
2014-06-23 19:07:50 +03:00
|
|
|
name: 'new user fb name',
|
2017-03-18 22:43:46 +02:00
|
|
|
email: 'test-1@example.com'
|
2014-06-18 18:59:01 +03:00
|
|
|
},
|
|
|
|
|
credentials: {
|
|
|
|
|
token: 'mock_token',
|
|
|
|
|
secret: 'mock_secret'
|
|
|
|
|
}
|
|
|
|
|
)
|
2014-06-18 16:58:30 +03:00
|
|
|
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.
|
2014-06-18 18:59:01 +03:00
|
|
|
OmniAuth.config.mock_auth[:google] =
|
|
|
|
|
OmniAuth::AuthHash.new(
|
|
|
|
|
provider: 'google',
|
|
|
|
|
uid: 'google-test-uid-participant-1',
|
|
|
|
|
info: {
|
2014-06-23 19:07:50 +03:00
|
|
|
name: 'existing user participant name',
|
2017-03-18 22:43:46 +02:00
|
|
|
email: 'test-participant-1@example.com'
|
2014-06-18 18:59:01 +03:00
|
|
|
},
|
|
|
|
|
credentials: {
|
|
|
|
|
token: 'mock_token',
|
|
|
|
|
secret: 'mock_secret'
|
|
|
|
|
}
|
|
|
|
|
)
|
2014-06-18 16:58:30 +03:00
|
|
|
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.
|
2014-06-18 18:59:01 +03:00
|
|
|
OmniAuth.config.mock_auth[:google] =
|
|
|
|
|
OmniAuth::AuthHash.new(
|
|
|
|
|
provider: 'google',
|
|
|
|
|
uid: 'google-test-uid-admin-1',
|
|
|
|
|
info: {
|
2014-06-23 19:07:50 +03:00
|
|
|
name: 'existing user admin name',
|
2017-03-18 22:43:46 +02:00
|
|
|
email: 'test-admin-1@example.com'
|
2014-06-18 18:59:01 +03:00
|
|
|
},
|
|
|
|
|
credentials: {
|
|
|
|
|
token: 'mock_token',
|
|
|
|
|
secret: 'mock_secret'
|
|
|
|
|
}
|
|
|
|
|
)
|
2014-06-18 16:58:30 +03:00
|
|
|
end
|
2014-06-18 18:05:28 +03:00
|
|
|
end
|