We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent accba7a commit 601dfceCopy full SHA for 601dfce
1 file changed
spec/github/client/authorizations/two_factor_spec.rb
@@ -0,0 +1,22 @@
1
+# encoding: utf-8
2
+
3
+require 'spec_helper'
4
5
+RSpec.describe Github::Client::Authorizations, 'two-factor' do
6
+ let(:basic_auth) { 'login:password' }
7
+ let(:host) { "https://#{basic_auth}@api.github.com" }
8
9
+ it "fails with known OTP error" do
10
+ stub_get("/authorizations/1", host).to_return(
11
+ status: 401,
12
+ headers: {
13
+ content_type: 'application/json',
14
+ 'X-GitHub-OTP' => 'required; sms'
15
+ },
16
+ body: {message: "Require two-factor authentication OTP token."}
17
+ )
18
+ expect {
19
+ described_class.new(basic_auth: 'login:password').get(1)
20
+ }.to raise_error(Github::Error::Unauthorized, /Require two-factor/)
21
+ end
22
+end
0 commit comments