kensa 1.2.0rc7 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/Gemfile +5 -4
- data/Gemfile.lock +21 -27
- data/README.md +1 -1
- data/Rakefile +18 -10
- data/bin/kensa +10 -30
- data/kensa.gemspec +27 -20
- data/lib/heroku/kensa.rb +7 -9
- data/lib/heroku/kensa/check.rb +499 -0
- data/lib/heroku/kensa/client.rb +67 -89
- data/lib/heroku/kensa/git.rb +39 -0
- data/lib/heroku/kensa/manifest.rb +41 -8
- data/lib/heroku/kensa/screen.rb +37 -0
- data/lib/heroku/kensa/sso.rb +22 -22
- data/lib/heroku/kensa/version.rb +1 -2
- data/test/all_check_test.rb +25 -0
- data/test/create_test.rb +40 -6
- data/test/deprovision_check_test.rb +39 -0
- data/test/helper.rb +74 -11
- data/test/init_test.rb +54 -0
- data/test/manifest_check_test.rb +94 -0
- data/test/manifest_test.rb +37 -33
- data/test/plan_change_check_test.rb +31 -0
- data/test/provision_check_test.rb +51 -0
- data/test/provision_response_check_test.rb +81 -0
- data/test/resources/runner.rb +1 -0
- data/test/resources/server.rb +227 -0
- data/test/sso_check_test.rb +58 -0
- data/test/sso_test.rb +113 -53
- metadata +97 -91
- data/test.rb +0 -1
- data/test/deprovision_test.rb +0 -30
- data/test/lib/dependencies.rb +0 -12
- data/test/lib/formatter.rb +0 -84
- data/test/lib/http.rb +0 -60
- data/test/lib/response.rb +0 -12
- data/test/manifest_generation_test.rb +0 -32
- data/test/plan_change_test.rb +0 -30
- data/test/provision_test.rb +0 -84
- data/test/resources/provider_server.rb +0 -81
- data/test/resources/views/index.haml +0 -6
- data/test/sso_launch_test.rb +0 -130
data/test/sso_test.rb
CHANGED
@@ -1,70 +1,130 @@
|
|
1
|
-
|
2
|
-
require '
|
1
|
+
require 'test/helper'
|
2
|
+
require 'cgi'
|
3
|
+
|
3
4
|
class SsoTest < Test::Unit::TestCase
|
5
|
+
include Heroku::Kensa
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
"nav-data" => "some-nav-data"
|
12
|
-
}
|
13
|
-
end
|
7
|
+
context "with GET" do
|
8
|
+
setup do
|
9
|
+
@data = Manifest.new.skeleton.merge(:id => 1)
|
10
|
+
@data['api']['test'] = 'http://localhost:4567/'
|
11
|
+
@data['api']['sso_salt'] = 'SSO_SALT'
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
manifest["api"]["test"].is_a?(Hash) &&
|
17
|
-
manifest["api"]["test"]["sso_url"]
|
18
|
-
end
|
14
|
+
teardown { Timecop.return }
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
def builds_full_url(env)
|
17
|
+
url, query = @sso.full_url.split('?')
|
18
|
+
data = CGI.parse(query)
|
19
|
+
|
20
|
+
|
21
|
+
assert_equal "#{@data['api'][env]}heroku/resources/1", url
|
22
|
+
assert_equal 'b6010f6fbb850887a396c2bc0ab23974003008f6', data['token'].first
|
23
|
+
assert_equal '1262304000', data['timestamp'].first
|
24
|
+
assert_equal 'username@example.com', data['email'].first
|
25
25
|
end
|
26
|
-
end
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
context 'sso' do
|
28
|
+
setup do
|
29
|
+
Timecop.freeze Time.utc(2010, 1)
|
30
|
+
@sso = Sso.new @data
|
31
|
+
end
|
32
|
+
|
33
|
+
test 'builds path' do
|
34
|
+
assert_equal '/heroku/resources/1', @sso.path
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'builds full url' do
|
38
|
+
builds_full_url('test')
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with no "sso" field specified' do
|
42
|
+
test "defaults to GET" do
|
43
|
+
assert_equal @sso.full_url, @sso.sso_url
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when sso method is GET' do
|
48
|
+
setup do
|
49
|
+
@data['api']['sso'] = 'GET'
|
50
|
+
@sso = Sso.new(@data).start
|
51
|
+
end
|
52
|
+
|
53
|
+
test "#sso_url should be the #full_url" do
|
54
|
+
assert_equal @sso.full_url, @sso.sso_url
|
55
|
+
end
|
56
|
+
|
57
|
+
test "#message is Opening <full_url>" do
|
58
|
+
assert_equal "Opening #{@sso.full_url}", @sso.message
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
33
62
|
end
|
34
|
-
end
|
35
63
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
64
|
+
context 'sso without salt' do
|
65
|
+
setup do
|
66
|
+
@data['api'].delete 'sso_salt'
|
67
|
+
@sso = Sso.new @data
|
68
|
+
end
|
41
69
|
|
42
|
-
|
43
|
-
|
44
|
-
@params[:token] = make_token(123, "SSO_SALT", @params[:timestamp].to_s)
|
45
|
-
response = sso_login
|
46
|
-
assert_equal 403, response.code, "Signing in via SSO at /heroku/resources/:id must return a 403 if the timestamp is expired."
|
70
|
+
test 'builds full url' do
|
71
|
+
expected = 'http://localhost:4567/heroku/resources/1'
|
47
72
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
73
|
+
assert @sso.full_url.include?(expected)
|
74
|
+
end
|
75
|
+
end
|
52
76
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
77
|
+
context 'sso in production' do
|
78
|
+
setup do
|
79
|
+
Timecop.freeze Time.utc(2010, 1)
|
80
|
+
env = 'production'
|
81
|
+
@data[:env] = env
|
82
|
+
@data['api'][env] = 'http://localhost:7654/'
|
57
83
|
|
58
|
-
|
59
|
-
|
84
|
+
@sso = Sso.new @data
|
85
|
+
end
|
60
86
|
|
61
|
-
|
62
|
-
|
87
|
+
test 'builds full url' do
|
88
|
+
builds_full_url('production')
|
89
|
+
end
|
90
|
+
end
|
63
91
|
end
|
64
92
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
93
|
+
context "via POST" do
|
94
|
+
setup do
|
95
|
+
Timecop.freeze Time.utc(2010, 1)
|
96
|
+
@data = Manifest.new(:method => :post).skeleton.merge(:id => 1)
|
97
|
+
@data['api']['sso_salt'] = 'SSO_SALT'
|
98
|
+
end
|
99
|
+
|
100
|
+
test "it starts the proxy server" do
|
101
|
+
@sso = Sso.new(@data).start
|
102
|
+
body = RestClient.get(@sso.sso_url)
|
103
|
+
|
104
|
+
assert body.include? @sso.path
|
105
|
+
assert body.include? 'b6010f6fbb850887a396c2bc0ab23974003008f6'
|
106
|
+
assert body.include? '1262304000'
|
107
|
+
assert body.include? @sso.url
|
108
|
+
assert body.include? @sso.sample_nav_data
|
109
|
+
end
|
110
|
+
|
111
|
+
context "with the proxy working" do
|
112
|
+
setup do
|
113
|
+
any_instance_of(Sso, :run_proxy => false)
|
114
|
+
@sso = Sso.new(@data).start
|
115
|
+
end
|
116
|
+
|
117
|
+
test "#sso_url should point to the proxy" do
|
118
|
+
assert_equal "http://localhost:#{@sso.proxy_port}/", @sso.sso_url
|
119
|
+
end
|
120
|
+
|
121
|
+
test "#post_url contains url and path" do
|
122
|
+
assert_equal "http://localhost:4567/sso/login", @sso.post_url
|
123
|
+
end
|
124
|
+
|
125
|
+
test "#message is Posting <data> to <post_url> via proxy on port <proxy_port>" do
|
126
|
+
assert_equal "POSTing #{@sso.query_data} to http://localhost:4567/sso/login via proxy on port #{@sso.proxy_port}", @sso.message
|
127
|
+
end
|
128
|
+
end
|
69
129
|
end
|
70
130
|
end
|
metadata
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kensa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Blake Mizerany
|
9
9
|
- Pedro Belo
|
10
10
|
- Adam Wiggins
|
11
|
-
- Chris Continanza
|
12
11
|
- Glenn Gillen
|
12
|
+
- Chris Continanza
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2011-
|
16
|
+
date: 2011-11-18 00:00:00.000000000Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
|
-
name:
|
20
|
-
requirement: &
|
19
|
+
name: contest
|
20
|
+
requirement: &70130076419400 !ruby/object:Gem::Requirement
|
21
21
|
none: false
|
22
22
|
requirements:
|
23
23
|
- - ! '>='
|
@@ -25,120 +25,134 @@ dependencies:
|
|
25
25
|
version: '0'
|
26
26
|
type: :development
|
27
27
|
prerelease: false
|
28
|
-
version_requirements: *
|
28
|
+
version_requirements: *70130076419400
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
31
|
-
requirement: &
|
30
|
+
name: timecop
|
31
|
+
requirement: &70130076416540 !ruby/object:Gem::Requirement
|
32
32
|
none: false
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - ! '>='
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: 0.3.5
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
|
-
version_requirements: *
|
39
|
+
version_requirements: *70130076416540
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
42
|
-
requirement: &
|
41
|
+
name: sinatra
|
42
|
+
requirement: &70130076414660 !ruby/object:Gem::Requirement
|
43
43
|
none: false
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: '0.9'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
|
-
version_requirements: *
|
50
|
+
version_requirements: *70130076414660
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
|
-
name:
|
53
|
-
requirement: &
|
52
|
+
name: json
|
53
|
+
requirement: &70130076412640 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ! '>='
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
58
|
+
version: '0'
|
59
59
|
type: :development
|
60
60
|
prerelease: false
|
61
|
-
version_requirements: *
|
61
|
+
version_requirements: *70130076412640
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
64
|
-
requirement: &
|
63
|
+
name: contest
|
64
|
+
requirement: &70130076411500 !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0
|
69
|
+
version: '0'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
|
-
version_requirements: *
|
72
|
+
version_requirements: *70130076411500
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: haml
|
75
|
-
requirement: &
|
75
|
+
requirement: &70130076410000 !ruby/object:Gem::Requirement
|
76
76
|
none: false
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ! '>='
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
80
|
+
version: '0'
|
81
81
|
type: :development
|
82
82
|
prerelease: false
|
83
|
-
version_requirements: *
|
83
|
+
version_requirements: *70130076410000
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
86
|
-
requirement: &
|
85
|
+
name: rr
|
86
|
+
requirement: &70130076408820 !ruby/object:Gem::Requirement
|
87
87
|
none: false
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - ! '>='
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
92
|
-
type: :
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: *70130076408820
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: fakefs
|
97
|
+
requirement: &70130076407080 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
93
104
|
prerelease: false
|
94
|
-
version_requirements: *
|
105
|
+
version_requirements: *70130076407080
|
95
106
|
- !ruby/object:Gem::Dependency
|
96
107
|
name: rest-client
|
97
|
-
requirement: &
|
108
|
+
requirement: &70130076404080 !ruby/object:Gem::Requirement
|
98
109
|
none: false
|
99
110
|
requirements:
|
100
|
-
- -
|
111
|
+
- - <
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 1.7.0
|
114
|
+
- - ! '>='
|
101
115
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.
|
116
|
+
version: 1.4.0
|
103
117
|
type: :runtime
|
104
118
|
prerelease: false
|
105
|
-
version_requirements: *
|
119
|
+
version_requirements: *70130076404080
|
106
120
|
- !ruby/object:Gem::Dependency
|
107
121
|
name: yajl-ruby
|
108
|
-
requirement: &
|
122
|
+
requirement: &70130076399200 !ruby/object:Gem::Requirement
|
109
123
|
none: false
|
110
124
|
requirements:
|
111
125
|
- - ~>
|
112
126
|
- !ruby/object:Gem::Version
|
113
|
-
version: 0.
|
127
|
+
version: '0.6'
|
114
128
|
type: :runtime
|
115
129
|
prerelease: false
|
116
|
-
version_requirements: *
|
130
|
+
version_requirements: *70130076399200
|
117
131
|
- !ruby/object:Gem::Dependency
|
118
132
|
name: term-ansicolor
|
119
|
-
requirement: &
|
133
|
+
requirement: &70130076396960 !ruby/object:Gem::Requirement
|
120
134
|
none: false
|
121
135
|
requirements:
|
122
136
|
- - ~>
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.0
|
138
|
+
version: '1.0'
|
125
139
|
type: :runtime
|
126
140
|
prerelease: false
|
127
|
-
version_requirements: *
|
141
|
+
version_requirements: *70130076396960
|
128
142
|
- !ruby/object:Gem::Dependency
|
129
143
|
name: launchy
|
130
|
-
requirement: &
|
144
|
+
requirement: &70130076393800 !ruby/object:Gem::Requirement
|
131
145
|
none: false
|
132
146
|
requirements:
|
133
|
-
- -
|
147
|
+
- - ! '>='
|
134
148
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
149
|
+
version: 0.3.2
|
136
150
|
type: :runtime
|
137
151
|
prerelease: false
|
138
|
-
version_requirements: *
|
152
|
+
version_requirements: *70130076393800
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: mechanize
|
141
|
-
requirement: &
|
155
|
+
requirement: &70130076392720 !ruby/object:Gem::Requirement
|
142
156
|
none: false
|
143
157
|
requirements:
|
144
158
|
- - ~>
|
@@ -146,22 +160,11 @@ dependencies:
|
|
146
160
|
version: 1.0.0
|
147
161
|
type: :runtime
|
148
162
|
prerelease: false
|
149
|
-
version_requirements: *
|
150
|
-
- !ruby/object:Gem::Dependency
|
151
|
-
name: artifice
|
152
|
-
requirement: &70357298657560 !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ~>
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: 0.6.0
|
158
|
-
type: :runtime
|
159
|
-
prerelease: false
|
160
|
-
version_requirements: *70357298657560
|
163
|
+
version_requirements: *70130076392720
|
161
164
|
description: Kensa is a command-line tool to help add-on providers integrating their
|
162
165
|
services with Heroku. It manages manifest files, and provides a TDD-like approach
|
163
166
|
for programmers to test and develop their APIs.
|
164
|
-
email:
|
167
|
+
email: pedro@heroku.com
|
165
168
|
executables:
|
166
169
|
- kensa
|
167
170
|
extensions: []
|
@@ -175,28 +178,29 @@ files:
|
|
175
178
|
- bin/kensa
|
176
179
|
- kensa.gemspec
|
177
180
|
- lib/heroku/kensa.rb
|
181
|
+
- lib/heroku/kensa/check.rb
|
178
182
|
- lib/heroku/kensa/client.rb
|
183
|
+
- lib/heroku/kensa/git.rb
|
179
184
|
- lib/heroku/kensa/http.rb
|
180
185
|
- lib/heroku/kensa/manifest.rb
|
181
186
|
- lib/heroku/kensa/post_proxy.rb
|
187
|
+
- lib/heroku/kensa/screen.rb
|
182
188
|
- lib/heroku/kensa/sso.rb
|
183
189
|
- lib/heroku/kensa/version.rb
|
184
190
|
- set-env.sh
|
185
|
-
- test.rb
|
191
|
+
- test/all_check_test.rb
|
186
192
|
- test/create_test.rb
|
187
|
-
- test/
|
193
|
+
- test/deprovision_check_test.rb
|
188
194
|
- test/helper.rb
|
189
|
-
- test/
|
190
|
-
- test/
|
191
|
-
- test/lib/http.rb
|
192
|
-
- test/lib/response.rb
|
193
|
-
- test/manifest_generation_test.rb
|
195
|
+
- test/init_test.rb
|
196
|
+
- test/manifest_check_test.rb
|
194
197
|
- test/manifest_test.rb
|
195
|
-
- test/
|
196
|
-
- test/
|
197
|
-
- test/
|
198
|
-
- test/resources/
|
199
|
-
- test/
|
198
|
+
- test/plan_change_check_test.rb
|
199
|
+
- test/provision_check_test.rb
|
200
|
+
- test/provision_response_check_test.rb
|
201
|
+
- test/resources/runner.rb
|
202
|
+
- test/resources/server.rb
|
203
|
+
- test/sso_check_test.rb
|
200
204
|
- test/sso_test.rb
|
201
205
|
homepage: http://provider.heroku.com/resources
|
202
206
|
licenses: []
|
@@ -212,13 +216,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
216
|
version: '0'
|
213
217
|
segments:
|
214
218
|
- 0
|
215
|
-
hash:
|
219
|
+
hash: 3834118791582110421
|
216
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
221
|
none: false
|
218
222
|
requirements:
|
219
|
-
- - ! '
|
223
|
+
- - ! '>='
|
220
224
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
225
|
+
version: '0'
|
226
|
+
segments:
|
227
|
+
- 0
|
228
|
+
hash: 3834118791582110421
|
222
229
|
requirements: []
|
223
230
|
rubyforge_project: kensa
|
224
231
|
rubygems_version: 1.8.10
|
@@ -226,18 +233,17 @@ signing_key:
|
|
226
233
|
specification_version: 3
|
227
234
|
summary: Tool to help Heroku add-on providers integrating their services
|
228
235
|
test_files:
|
236
|
+
- test/all_check_test.rb
|
229
237
|
- test/create_test.rb
|
230
|
-
- test/
|
238
|
+
- test/deprovision_check_test.rb
|
231
239
|
- test/helper.rb
|
232
|
-
- test/
|
233
|
-
- test/
|
234
|
-
- test/lib/http.rb
|
235
|
-
- test/lib/response.rb
|
236
|
-
- test/manifest_generation_test.rb
|
240
|
+
- test/init_test.rb
|
241
|
+
- test/manifest_check_test.rb
|
237
242
|
- test/manifest_test.rb
|
238
|
-
- test/
|
239
|
-
- test/
|
240
|
-
- test/
|
241
|
-
- test/resources/
|
242
|
-
- test/
|
243
|
+
- test/plan_change_check_test.rb
|
244
|
+
- test/provision_check_test.rb
|
245
|
+
- test/provision_response_check_test.rb
|
246
|
+
- test/resources/runner.rb
|
247
|
+
- test/resources/server.rb
|
248
|
+
- test/sso_check_test.rb
|
243
249
|
- test/sso_test.rb
|