Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-06-30 22:54:07 +0300
committerPatricio Cano <suprnova32@gmail.com>2016-07-04 19:00:34 +0300
commit5467260528018774c8baec65f3cbf692bb3d93b7 (patch)
tree031189c2b675941eb500e7ffa70394c21980dad2 /spec/support/login_helpers.rb
parent54c514f24ee00d885ec633a137a78a4cc71c6781 (diff)
Added tests for 2FA check on OAuth request
Diffstat (limited to 'spec/support/login_helpers.rb')
-rw-r--r--spec/support/login_helpers.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb
index 7a0f078c72b..75a8846c0da 100644
--- a/spec/support/login_helpers.rb
+++ b/spec/support/login_helpers.rb
@@ -37,6 +37,31 @@ module LoginHelpers
Thread.current[:current_user] = user
end
+ def login_via(provider, user, uid)
+ mock_auth_hash(provider, uid, user.email)
+ visit new_user_session_path
+ #page.find('.oauth-image-link').click
+ click_link provider
+ end
+
+ def mock_auth_hash(provider, uid, email)
+ # The mock_auth configuration allows you to set per-provider (or default)
+ # authentication hashes to return during integration testing.
+ OmniAuth.config.mock_auth[provider.to_sym] = OmniAuth::AuthHash.new({
+ provider: provider,
+ uid: uid,
+ info: {
+ name: 'mockuser',
+ email: email,
+ image: 'mock_user_thumbnail_url'
+ },
+ credentials: {
+ token: 'mock_token',
+ secret: 'mock_secret'
+ }
+ })
+ end
+
# Requires Javascript driver.
def logout
find(:css, ".fa.fa-sign-out").click