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_launch_test.rb
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
$:.unshift(File.expand_path("../..",__FILE__))
|
2
|
-
require 'test/helper'
|
3
|
-
require 'cgi'
|
4
|
-
|
5
|
-
module SsoSetupActions
|
6
|
-
include Heroku::Kensa
|
7
|
-
|
8
|
-
def sso_setup
|
9
|
-
Timecop.freeze Time.utc(2010, 1)
|
10
|
-
@data = Manifest.new.skeleton.merge(:id => 1)
|
11
|
-
@data['api']['test'] = 'http://localhost:4567/'
|
12
|
-
@data['api']['sso_salt'] = 'SSO_SALT'
|
13
|
-
@sso = Sso.new @data
|
14
|
-
end
|
15
|
-
|
16
|
-
def asserts_builds_full_url(env)
|
17
|
-
url, query = @sso.full_url.split('?')
|
18
|
-
data = CGI.parse(query)
|
19
|
-
|
20
|
-
assert_equal "#{@data['api'][env]}heroku/resources/1", url
|
21
|
-
assert_equal 'b6010f6fbb850887a396c2bc0ab23974003008f6', data['token'].first
|
22
|
-
assert_equal '1262304000', data['timestamp'].first
|
23
|
-
assert_equal 'username@example.com', data['user'].first
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class SsoLaunchTest < Test::Unit::TestCase
|
28
|
-
include SsoSetupActions
|
29
|
-
|
30
|
-
def setup
|
31
|
-
super
|
32
|
-
sso_setup
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_builds_path
|
36
|
-
assert_equal '/heroku/resources/1', @sso.path
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_builds_full_url
|
40
|
-
asserts_builds_full_url('test')
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
class SsoGetLaunchTest < Test::Unit::TestCase
|
45
|
-
include SsoSetupActions
|
46
|
-
|
47
|
-
def setup
|
48
|
-
super
|
49
|
-
sso_setup
|
50
|
-
@data["api"]["test"] = "http://example.org/"
|
51
|
-
@sso = Sso.new(@data).start
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_sso_url_should_be_the_full_url
|
55
|
-
assert_equal @sso.full_url, @sso.sso_url
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_message_is_opening_full_url
|
59
|
-
assert_equal "Opening #{@sso.full_url}", @sso.message
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class SsoPostLaunchTest < Test::Unit::TestCase
|
64
|
-
include SsoSetupActions
|
65
|
-
|
66
|
-
def setup
|
67
|
-
super
|
68
|
-
sso_setup
|
69
|
-
@data['api']['test'] = {
|
70
|
-
"base_url" => "http://localhost:4567",
|
71
|
-
"sso_url" => "http://localhost:4567/users/login/sso"
|
72
|
-
}
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_it_starts_the_proxy_server
|
76
|
-
Artifice.deactivate
|
77
|
-
@sso = Sso.new(@data).start
|
78
|
-
body = RestClient.get(@sso.sso_url)
|
79
|
-
|
80
|
-
assert body.include? 'b6010f6fbb850887a396c2bc0ab23974003008f6'
|
81
|
-
assert body.include? '1262304000'
|
82
|
-
assert body.include? @sso.url
|
83
|
-
assert body.include? @sso.sample_nav_data
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
class SsoPostProxyLaunchTest < Test::Unit::TestCase
|
88
|
-
include SsoSetupActions
|
89
|
-
|
90
|
-
def setup
|
91
|
-
super
|
92
|
-
sso_setup
|
93
|
-
@data['api']['test'] = {
|
94
|
-
"base_url" => "http://localhost:4567",
|
95
|
-
"sso_url" => "http://localhost:4567/users/login/sso"
|
96
|
-
}
|
97
|
-
any_instance_of(Sso, :run_proxy => false)
|
98
|
-
@sso = Sso.new(@data).start
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_sso_url_should_point_to_the_proxy
|
102
|
-
assert_equal "http://localhost:#{@sso.proxy_port}/", @sso.sso_url
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_post_url_contains_url_and_path
|
106
|
-
assert_equal "http://localhost:4567/users/login/sso", @sso.post_url
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_message_is_posting_data_to_post_url_via_proxy_on_port_proxy_port
|
110
|
-
assert_equal "POSTing #{@sso.query_data} to #{@sso.post_url} via proxy on port #{@sso.proxy_port}", @sso.message
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
class SsoEnvironmentLaunchTest < Test::Unit::TestCase
|
115
|
-
include SsoSetupActions
|
116
|
-
|
117
|
-
def setup
|
118
|
-
super
|
119
|
-
sso_setup
|
120
|
-
env = 'production'
|
121
|
-
@data[:env] = env
|
122
|
-
@data['api'][env] = 'http://localhost:7654/'
|
123
|
-
|
124
|
-
@sso = Sso.new @data
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_builds_full_url
|
128
|
-
asserts_builds_full_url('production')
|
129
|
-
end
|
130
|
-
end
|