summaryrefslogtreecommitdiff
path: root/spec/gitlab_net_spec.rb
diff options
context:
space:
mode:
authorDrew Blessing <drew@gitlab.com>2016-08-20 13:07:00 -0500
committerDrew Blessing <drew@gitlab.com>2016-08-26 15:10:31 -0500
commitdcc20876554ae18c6869b80071728f1b91858c5f (patch)
tree5e5dc709238c54a8e5213cd11f577751fc744ef8 /spec/gitlab_net_spec.rb
parent3043b31c458bf720843a84b35c9fbad5c1488c1d (diff)
downloadgitlab-shell-dcc20876554ae18c6869b80071728f1b91858c5f.tar.gz
Add option to recover 2FA via SSH
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r--spec/gitlab_net_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb
index d4585d2..bcd0d79 100644
--- a/spec/gitlab_net_spec.rb
+++ b/spec/gitlab_net_spec.rb
@@ -106,6 +106,24 @@ describe GitlabNet, vcr: true do
end
end
+ describe '#two_factor_recovery_codes' do
+ it 'returns two factor recovery codes' do
+ VCR.use_cassette('two-factor-recovery-codes') do
+ result = gitlab_net.two_factor_recovery_codes('key-1')
+ expect(result['success']).to be_true
+ expect(result['recovery_codes']).to eq(['f67c514de60c4953','41278385fc00c1e0'])
+ end
+ end
+
+ it 'returns false when recovery codes cannot be generated' do
+ VCR.use_cassette('two-factor-recovery-codes-fail') do
+ result = gitlab_net.two_factor_recovery_codes('key-1')
+ expect(result['success']).to be_false
+ expect(result['message']).to eq('Could not find the given key')
+ end
+ end
+ end
+
describe :check_access do
context 'ssh key with access to project' do
it 'should allow pull access for dev.gitlab.org' do