octoauth 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +3 -3
- data/circle.yml +13 -0
- data/lib/octoauth/auth.rb +14 -12
- data/octoauth.gemspec +7 -7
- data/spec/examples/existing_token.yml +2 -0
- data/spec/examples/write_first_test.yml +2 -0
- data/spec/fixtures/cassettes/alternate_endpoints.yml +193 -0
- data/spec/fixtures/cassettes/autosaving_config_file.yml +145 -15
- data/spec/fixtures/cassettes/create_token.yml +193 -0
- data/spec/fixtures/cassettes/handle_two_factor.yml +209 -11
- data/spec/fixtures/cassettes/recreate_token.yml +383 -0
- data/spec/fixtures/cassettes/requesting_scopes.yml +145 -15
- data/spec/fixtures/cassettes/write_to_first_file.yml +193 -0
- data/spec/octoauth/auth_spec.rb +62 -87
- data/spec/octoauth/configfile_spec.rb +7 -7
- data/spec/spec_helper.rb +12 -8
- metadata +28 -26
- data/.travis.yml +0 -17
- data/spec/examples/conf_a.yml +0 -3
- data/spec/fixtures/cassettes/Write_to_first_file.yml +0 -63
- data/spec/fixtures/cassettes/creates_new_token.yml +0 -63
- data/spec/fixtures/cassettes/request_user_input.yml +0 -63
- data/spec/fixtures/cassettes/save_to_disk.yml +0 -63
@@ -10,10 +10,10 @@ describe Octoauth do
|
|
10
10
|
context 'when given a file path' do
|
11
11
|
it 'loads that config' do
|
12
12
|
config = Octoauth::ConfigFile.new(
|
13
|
-
note: '
|
14
|
-
file: 'spec/examples/
|
13
|
+
note: 'existing_token',
|
14
|
+
file: 'spec/examples/existing_token.yml'
|
15
15
|
)
|
16
|
-
expect(config.token).to eql '
|
16
|
+
expect(config.token).to eql 'an_existing_token'
|
17
17
|
end
|
18
18
|
it 'returns nil if the file does not exist' do
|
19
19
|
config = Octoauth::ConfigFile.new(note: 'foo', file: 'wat')
|
@@ -27,7 +27,7 @@ describe Octoauth do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
context 'when given no file' do
|
30
|
-
it 'returns
|
30
|
+
it 'returns nil data' do
|
31
31
|
config = Octoauth::ConfigFile.new(note: 'foo')
|
32
32
|
expect(config.token).to be_nil
|
33
33
|
expect(config.file).to be_nil
|
@@ -37,17 +37,17 @@ describe Octoauth do
|
|
37
37
|
|
38
38
|
describe '#write' do
|
39
39
|
it 'saves a config to disk' do
|
40
|
-
FileUtils.rm_f 'spec/examples/
|
40
|
+
FileUtils.rm_f 'spec/examples/config_save_test.yml'
|
41
41
|
random = rand(36**30).to_s(30)
|
42
42
|
config = Octoauth::ConfigFile.new(
|
43
43
|
note: 'bar',
|
44
|
-
file: 'spec/examples/
|
44
|
+
file: 'spec/examples/config_save_test.yml'
|
45
45
|
)
|
46
46
|
config.token = random
|
47
47
|
config.write
|
48
48
|
new_config = Octoauth::ConfigFile.new(
|
49
49
|
note: 'bar',
|
50
|
-
file: 'spec/examples/
|
50
|
+
file: 'spec/examples/config_save_test.yml'
|
51
51
|
)
|
52
52
|
expect(new_config.token).to eql random
|
53
53
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
|
2
|
-
require '
|
3
|
-
|
4
|
-
SimpleCov.formatter =
|
5
|
-
SimpleCov.start do
|
6
|
-
|
1
|
+
if ENV['CI'] == 'true'
|
2
|
+
require 'simplecov'
|
3
|
+
require 'codecov'
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter '/spec/'
|
7
|
+
end
|
7
8
|
end
|
8
9
|
|
9
10
|
require 'rspec'
|
@@ -13,11 +14,14 @@ require 'vcr'
|
|
13
14
|
VCR.configure do |c|
|
14
15
|
c.cassette_library_dir = 'spec/fixtures/cassettes'
|
15
16
|
c.hook_into :webmock
|
17
|
+
c.filter_sensitive_data('<USER>') { ENV['OCTOAUTH_LOGIN'] || 'user' }
|
18
|
+
c.filter_sensitive_data('<PASSWORD>') { ENV['OCTOAUTH_PASSWORD'] || 'pw' }
|
16
19
|
c.before_record do |i|
|
17
|
-
|
20
|
+
%w(Authorization X-GitHub-OTP).each do |header|
|
21
|
+
i.request.headers.delete header
|
22
|
+
end
|
18
23
|
%w(Etag X-Github-Request-Id X-Served-By).each do |header|
|
19
24
|
i.response.headers.delete header
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
23
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octoauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: userinput
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.35.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.35.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,33 +67,33 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 10.4.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: codecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.1.1
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.1.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.
|
89
|
+
version: 3.4.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.
|
96
|
+
version: 3.4.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: fuubar
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,28 +114,28 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.22.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.22.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: vcr
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 3.0.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 3.0.0
|
139
139
|
description: Lightweight wrapper to sanely handle OAuth tokens with Octokit
|
140
140
|
email: me@lesaker.org
|
141
141
|
executables: []
|
@@ -145,24 +145,25 @@ files:
|
|
145
145
|
- ".gitignore"
|
146
146
|
- ".rspec"
|
147
147
|
- ".rubocop.yml"
|
148
|
-
- ".travis.yml"
|
149
148
|
- CHANGELOG.md
|
150
149
|
- Gemfile
|
151
150
|
- LICENSE
|
152
151
|
- README.md
|
153
152
|
- Rakefile
|
153
|
+
- circle.yml
|
154
154
|
- lib/octoauth.rb
|
155
155
|
- lib/octoauth/auth.rb
|
156
156
|
- lib/octoauth/configfile.rb
|
157
157
|
- octoauth.gemspec
|
158
|
-
- spec/examples/
|
159
|
-
- spec/
|
158
|
+
- spec/examples/existing_token.yml
|
159
|
+
- spec/examples/write_first_test.yml
|
160
|
+
- spec/fixtures/cassettes/alternate_endpoints.yml
|
160
161
|
- spec/fixtures/cassettes/autosaving_config_file.yml
|
161
|
-
- spec/fixtures/cassettes/
|
162
|
+
- spec/fixtures/cassettes/create_token.yml
|
162
163
|
- spec/fixtures/cassettes/handle_two_factor.yml
|
163
|
-
- spec/fixtures/cassettes/
|
164
|
+
- spec/fixtures/cassettes/recreate_token.yml
|
164
165
|
- spec/fixtures/cassettes/requesting_scopes.yml
|
165
|
-
- spec/fixtures/cassettes/
|
166
|
+
- spec/fixtures/cassettes/write_to_first_file.yml
|
166
167
|
- spec/octoauth/auth_spec.rb
|
167
168
|
- spec/octoauth/configfile_spec.rb
|
168
169
|
- spec/octoauth_spec.rb
|
@@ -192,14 +193,15 @@ signing_key:
|
|
192
193
|
specification_version: 4
|
193
194
|
summary: Auth token helper for GitHub API
|
194
195
|
test_files:
|
195
|
-
- spec/examples/
|
196
|
-
- spec/
|
196
|
+
- spec/examples/existing_token.yml
|
197
|
+
- spec/examples/write_first_test.yml
|
198
|
+
- spec/fixtures/cassettes/alternate_endpoints.yml
|
197
199
|
- spec/fixtures/cassettes/autosaving_config_file.yml
|
198
|
-
- spec/fixtures/cassettes/
|
200
|
+
- spec/fixtures/cassettes/create_token.yml
|
199
201
|
- spec/fixtures/cassettes/handle_two_factor.yml
|
200
|
-
- spec/fixtures/cassettes/
|
202
|
+
- spec/fixtures/cassettes/recreate_token.yml
|
201
203
|
- spec/fixtures/cassettes/requesting_scopes.yml
|
202
|
-
- spec/fixtures/cassettes/
|
204
|
+
- spec/fixtures/cassettes/write_to_first_file.yml
|
203
205
|
- spec/octoauth/auth_spec.rb
|
204
206
|
- spec/octoauth/configfile_spec.rb
|
205
207
|
- spec/octoauth_spec.rb
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
sudo: false
|
4
|
-
rvm:
|
5
|
-
- 2.2.2
|
6
|
-
- 2.2.1
|
7
|
-
- 2.2.0
|
8
|
-
- 2.1.6
|
9
|
-
- 2.0.0-p598
|
10
|
-
- 1.9.3-p551
|
11
|
-
notifications:
|
12
|
-
email: false
|
13
|
-
irc:
|
14
|
-
template:
|
15
|
-
- "%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}"
|
16
|
-
channels:
|
17
|
-
- irc.oftc.net#akerl
|
data/spec/examples/conf_a.yml
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://user:pw@api.github.com/authorizations
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"note":"foo","scopes":[],"fingerprint":"foo/bean"}'
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- application/vnd.github.v3+json
|
12
|
-
User-Agent:
|
13
|
-
- Octokit Ruby Gem 4.0.1
|
14
|
-
Content-Type:
|
15
|
-
- application/json
|
16
|
-
Accept-Encoding:
|
17
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 401
|
21
|
-
message: Unauthorized
|
22
|
-
headers:
|
23
|
-
Server:
|
24
|
-
- GitHub.com
|
25
|
-
Date:
|
26
|
-
- Sat, 25 Jul 2015 01:56:58 GMT
|
27
|
-
Content-Type:
|
28
|
-
- application/json; charset=utf-8
|
29
|
-
Content-Length:
|
30
|
-
- '83'
|
31
|
-
Status:
|
32
|
-
- 401 Unauthorized
|
33
|
-
X-Github-Media-Type:
|
34
|
-
- github.v3; format=json
|
35
|
-
X-Ratelimit-Limit:
|
36
|
-
- '60'
|
37
|
-
X-Ratelimit-Remaining:
|
38
|
-
- '54'
|
39
|
-
X-Ratelimit-Reset:
|
40
|
-
- '1437793018'
|
41
|
-
X-Xss-Protection:
|
42
|
-
- 1; mode=block
|
43
|
-
X-Frame-Options:
|
44
|
-
- deny
|
45
|
-
Content-Security-Policy:
|
46
|
-
- default-src 'none'
|
47
|
-
Access-Control-Allow-Credentials:
|
48
|
-
- 'true'
|
49
|
-
Access-Control-Expose-Headers:
|
50
|
-
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
51
|
-
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
52
|
-
Access-Control-Allow-Origin:
|
53
|
-
- "*"
|
54
|
-
Strict-Transport-Security:
|
55
|
-
- max-age=31536000; includeSubdomains; preload
|
56
|
-
X-Content-Type-Options:
|
57
|
-
- nosniff
|
58
|
-
body:
|
59
|
-
encoding: UTF-8
|
60
|
-
string: '{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}'
|
61
|
-
http_version:
|
62
|
-
recorded_at: Sat, 25 Jul 2015 01:56:58 GMT
|
63
|
-
recorded_with: VCR 2.9.3
|
@@ -1,63 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://user:pw@api.github.com/authorizations
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"note":"existing","scopes":[],"fingerprint":"existing/bean"}'
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- application/vnd.github.v3+json
|
12
|
-
User-Agent:
|
13
|
-
- Octokit Ruby Gem 4.0.1
|
14
|
-
Content-Type:
|
15
|
-
- application/json
|
16
|
-
Accept-Encoding:
|
17
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 401
|
21
|
-
message: Unauthorized
|
22
|
-
headers:
|
23
|
-
Server:
|
24
|
-
- GitHub.com
|
25
|
-
Date:
|
26
|
-
- Sat, 25 Jul 2015 01:56:58 GMT
|
27
|
-
Content-Type:
|
28
|
-
- application/json; charset=utf-8
|
29
|
-
Content-Length:
|
30
|
-
- '83'
|
31
|
-
Status:
|
32
|
-
- 401 Unauthorized
|
33
|
-
X-Github-Media-Type:
|
34
|
-
- github.v3; format=json
|
35
|
-
X-Ratelimit-Limit:
|
36
|
-
- '60'
|
37
|
-
X-Ratelimit-Remaining:
|
38
|
-
- '57'
|
39
|
-
X-Ratelimit-Reset:
|
40
|
-
- '1437793018'
|
41
|
-
X-Xss-Protection:
|
42
|
-
- 1; mode=block
|
43
|
-
X-Frame-Options:
|
44
|
-
- deny
|
45
|
-
Content-Security-Policy:
|
46
|
-
- default-src 'none'
|
47
|
-
Access-Control-Allow-Credentials:
|
48
|
-
- 'true'
|
49
|
-
Access-Control-Expose-Headers:
|
50
|
-
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
51
|
-
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
52
|
-
Access-Control-Allow-Origin:
|
53
|
-
- "*"
|
54
|
-
Strict-Transport-Security:
|
55
|
-
- max-age=31536000; includeSubdomains; preload
|
56
|
-
X-Content-Type-Options:
|
57
|
-
- nosniff
|
58
|
-
body:
|
59
|
-
encoding: UTF-8
|
60
|
-
string: '{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}'
|
61
|
-
http_version:
|
62
|
-
recorded_at: Sat, 25 Jul 2015 01:56:58 GMT
|
63
|
-
recorded_with: VCR 2.9.3
|
@@ -1,63 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://user:pw@api.github.com/authorizations
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"note":"foo","scopes":[],"fingerprint":"foo/bean"}'
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- application/vnd.github.v3+json
|
12
|
-
User-Agent:
|
13
|
-
- Octokit Ruby Gem 4.0.1
|
14
|
-
Content-Type:
|
15
|
-
- application/json
|
16
|
-
Accept-Encoding:
|
17
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 401
|
21
|
-
message: Unauthorized
|
22
|
-
headers:
|
23
|
-
Server:
|
24
|
-
- GitHub.com
|
25
|
-
Date:
|
26
|
-
- Sat, 25 Jul 2015 01:56:58 GMT
|
27
|
-
Content-Type:
|
28
|
-
- application/json; charset=utf-8
|
29
|
-
Content-Length:
|
30
|
-
- '83'
|
31
|
-
Status:
|
32
|
-
- 401 Unauthorized
|
33
|
-
X-Github-Media-Type:
|
34
|
-
- github.v3; format=json
|
35
|
-
X-Ratelimit-Limit:
|
36
|
-
- '60'
|
37
|
-
X-Ratelimit-Remaining:
|
38
|
-
- '56'
|
39
|
-
X-Ratelimit-Reset:
|
40
|
-
- '1437793018'
|
41
|
-
X-Xss-Protection:
|
42
|
-
- 1; mode=block
|
43
|
-
X-Frame-Options:
|
44
|
-
- deny
|
45
|
-
Content-Security-Policy:
|
46
|
-
- default-src 'none'
|
47
|
-
Access-Control-Allow-Credentials:
|
48
|
-
- 'true'
|
49
|
-
Access-Control-Expose-Headers:
|
50
|
-
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
51
|
-
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
52
|
-
Access-Control-Allow-Origin:
|
53
|
-
- "*"
|
54
|
-
Strict-Transport-Security:
|
55
|
-
- max-age=31536000; includeSubdomains; preload
|
56
|
-
X-Content-Type-Options:
|
57
|
-
- nosniff
|
58
|
-
body:
|
59
|
-
encoding: UTF-8
|
60
|
-
string: '{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}'
|
61
|
-
http_version:
|
62
|
-
recorded_at: Sat, 25 Jul 2015 01:56:58 GMT
|
63
|
-
recorded_with: VCR 2.9.3
|