pogo 2.31.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/README.md +73 -0
  2. data/bin/pogo +22 -0
  3. data/data/cacert.pem +3988 -0
  4. data/lib/heroku.rb +22 -0
  5. data/lib/heroku/auth.rb +320 -0
  6. data/lib/heroku/cli.rb +38 -0
  7. data/lib/heroku/client.rb +764 -0
  8. data/lib/heroku/client/heroku_postgresql.rb +111 -0
  9. data/lib/heroku/client/pgbackups.rb +113 -0
  10. data/lib/heroku/client/rendezvous.rb +105 -0
  11. data/lib/heroku/client/ssl_endpoint.rb +25 -0
  12. data/lib/heroku/command.rb +273 -0
  13. data/lib/heroku/command/account.rb +23 -0
  14. data/lib/heroku/command/accounts.rb +34 -0
  15. data/lib/heroku/command/addons.rb +305 -0
  16. data/lib/heroku/command/apps.rb +311 -0
  17. data/lib/heroku/command/auth.rb +86 -0
  18. data/lib/heroku/command/base.rb +230 -0
  19. data/lib/heroku/command/certs.rb +148 -0
  20. data/lib/heroku/command/config.rb +137 -0
  21. data/lib/heroku/command/db.rb +218 -0
  22. data/lib/heroku/command/domains.rb +85 -0
  23. data/lib/heroku/command/drains.rb +46 -0
  24. data/lib/heroku/command/git.rb +65 -0
  25. data/lib/heroku/command/help.rb +163 -0
  26. data/lib/heroku/command/keys.rb +115 -0
  27. data/lib/heroku/command/labs.rb +161 -0
  28. data/lib/heroku/command/logs.rb +98 -0
  29. data/lib/heroku/command/maintenance.rb +61 -0
  30. data/lib/heroku/command/pg.rb +277 -0
  31. data/lib/heroku/command/pgbackups.rb +289 -0
  32. data/lib/heroku/command/plugins.rb +110 -0
  33. data/lib/heroku/command/ps.rb +232 -0
  34. data/lib/heroku/command/releases.rb +124 -0
  35. data/lib/heroku/command/run.rb +179 -0
  36. data/lib/heroku/command/sharing.rb +89 -0
  37. data/lib/heroku/command/ssl.rb +61 -0
  38. data/lib/heroku/command/stack.rb +62 -0
  39. data/lib/heroku/command/status.rb +51 -0
  40. data/lib/heroku/command/update.rb +47 -0
  41. data/lib/heroku/command/version.rb +23 -0
  42. data/lib/heroku/deprecated.rb +5 -0
  43. data/lib/heroku/deprecated/help.rb +38 -0
  44. data/lib/heroku/distribution.rb +9 -0
  45. data/lib/heroku/helpers.rb +517 -0
  46. data/lib/heroku/helpers/heroku_postgresql.rb +104 -0
  47. data/lib/heroku/plugin.rb +161 -0
  48. data/lib/heroku/updater.rb +158 -0
  49. data/lib/heroku/version.rb +3 -0
  50. data/lib/vendor/heroku/okjson.rb +598 -0
  51. data/spec/helper/legacy_help.rb +16 -0
  52. data/spec/heroku/auth_spec.rb +246 -0
  53. data/spec/heroku/client/heroku_postgresql_spec.rb +34 -0
  54. data/spec/heroku/client/pgbackups_spec.rb +43 -0
  55. data/spec/heroku/client/rendezvous_spec.rb +62 -0
  56. data/spec/heroku/client/ssl_endpoint_spec.rb +48 -0
  57. data/spec/heroku/client_spec.rb +564 -0
  58. data/spec/heroku/command/addons_spec.rb +585 -0
  59. data/spec/heroku/command/apps_spec.rb +351 -0
  60. data/spec/heroku/command/auth_spec.rb +38 -0
  61. data/spec/heroku/command/base_spec.rb +109 -0
  62. data/spec/heroku/command/certs_spec.rb +178 -0
  63. data/spec/heroku/command/config_spec.rb +144 -0
  64. data/spec/heroku/command/db_spec.rb +110 -0
  65. data/spec/heroku/command/domains_spec.rb +87 -0
  66. data/spec/heroku/command/drains_spec.rb +34 -0
  67. data/spec/heroku/command/git_spec.rb +116 -0
  68. data/spec/heroku/command/help_spec.rb +93 -0
  69. data/spec/heroku/command/keys_spec.rb +120 -0
  70. data/spec/heroku/command/labs_spec.rb +99 -0
  71. data/spec/heroku/command/logs_spec.rb +60 -0
  72. data/spec/heroku/command/maintenance_spec.rb +51 -0
  73. data/spec/heroku/command/pg_spec.rb +223 -0
  74. data/spec/heroku/command/pgbackups_spec.rb +280 -0
  75. data/spec/heroku/command/plugins_spec.rb +104 -0
  76. data/spec/heroku/command/ps_spec.rb +195 -0
  77. data/spec/heroku/command/releases_spec.rb +130 -0
  78. data/spec/heroku/command/run_spec.rb +86 -0
  79. data/spec/heroku/command/sharing_spec.rb +59 -0
  80. data/spec/heroku/command/ssl_spec.rb +32 -0
  81. data/spec/heroku/command/stack_spec.rb +46 -0
  82. data/spec/heroku/command/status_spec.rb +48 -0
  83. data/spec/heroku/command/version_spec.rb +16 -0
  84. data/spec/heroku/command_spec.rb +211 -0
  85. data/spec/heroku/helpers/heroku_postgresql_spec.rb +109 -0
  86. data/spec/heroku/helpers_spec.rb +48 -0
  87. data/spec/heroku/plugin_spec.rb +172 -0
  88. data/spec/heroku/updater_spec.rb +44 -0
  89. data/spec/spec.opts +1 -0
  90. data/spec/spec_helper.rb +209 -0
  91. data/spec/support/display_message_matcher.rb +49 -0
  92. data/spec/support/openssl_mock_helper.rb +8 -0
  93. metadata +220 -0
@@ -0,0 +1,16 @@
1
+ require "heroku/command/help"
2
+
3
+ Heroku::Command::Help.group("Foo Group") do |foo|
4
+ foo.command "foo:bar", "do a bar to foo"
5
+ foo.space
6
+ foo.command "foo:baz", "do a baz to foo"
7
+ end
8
+
9
+ class Heroku::Command::Foo < Heroku::Command::Base
10
+ def bar
11
+ end
12
+
13
+ def baz
14
+ end
15
+ end
16
+
@@ -0,0 +1,246 @@
1
+ require "spec_helper"
2
+ require "heroku/auth"
3
+ require "heroku/helpers"
4
+
5
+ module Heroku
6
+ describe Auth do
7
+ include Heroku::Helpers
8
+
9
+ before do
10
+ ENV['HEROKU_API_KEY'] = nil
11
+
12
+ @cli = Heroku::Auth
13
+ @cli.stub!(:check)
14
+ @cli.stub!(:display)
15
+ @cli.stub!(:running_on_a_mac?).and_return(false)
16
+ @cli.credentials = nil
17
+
18
+ FakeFS.activate!
19
+
20
+ FakeFS::File.stub!(:stat).and_return(double('stat', :mode => "0600".to_i(8)))
21
+ FakeFS::FileUtils.stub!(:chmod)
22
+ FakeFS::File.stub!(:readlines) do |path|
23
+ File.read(path).split("\n").map {|line| "#{line}\n"}
24
+ end
25
+
26
+ FileUtils.mkdir_p(@cli.netrc_path.split("/")[0..-2].join("/"))
27
+
28
+ File.open(@cli.netrc_path, "w") do |file|
29
+ file.puts("machine api.heroku.com\n login user\n password pass\n")
30
+ file.puts("machine code.heroku.com\n login user\n password pass\n")
31
+ end
32
+ end
33
+
34
+ after do
35
+ FileUtils.rm_rf(@cli.netrc_path)
36
+ FakeFS.deactivate!
37
+ end
38
+
39
+ context "legacy credentials" do
40
+
41
+ before do
42
+ FileUtils.rm_rf(@cli.netrc_path)
43
+ FileUtils.mkdir_p(File.dirname(@cli.legacy_credentials_path))
44
+ File.open(@cli.legacy_credentials_path, "w") do |file|
45
+ file.puts "legacy_user\nlegacy_pass"
46
+ end
47
+ end
48
+
49
+ it "should translate to netrc and cleanup" do
50
+ # preconditions
51
+ File.exist?(@cli.legacy_credentials_path).should == true
52
+ File.exist?(@cli.netrc_path).should == false
53
+
54
+ # transition
55
+ @cli.get_credentials.should == ['legacy_user', 'legacy_pass']
56
+
57
+ # postconditions
58
+ File.exist?(@cli.legacy_credentials_path).should == false
59
+ File.exist?(@cli.netrc_path).should == true
60
+ Netrc.read(@cli.netrc_path)["api.#{@cli.host}"].should == ['legacy_user', 'legacy_pass']
61
+ end
62
+ end
63
+
64
+ context "API key is set via environment variable" do
65
+ before do
66
+ ENV['HEROKU_API_KEY'] = "secret"
67
+ end
68
+
69
+ it "gets credentials from environment variables in preference to credentials file" do
70
+ @cli.read_credentials.should == ['', ENV['HEROKU_API_KEY']]
71
+ end
72
+
73
+ it "returns a blank username" do
74
+ @cli.user.should be_empty
75
+ end
76
+
77
+ it "returns the api key as the password" do
78
+ @cli.password.should == ENV['HEROKU_API_KEY']
79
+ end
80
+
81
+ it "does not overwrite credentials file with environment variable credentials" do
82
+ @cli.should_not_receive(:write_credentials)
83
+ @cli.read_credentials
84
+ end
85
+
86
+ context "reauthenticating" do
87
+ before do
88
+ @cli.stub!(:ask_for_credentials).and_return(['new_user', 'new_password'])
89
+ @cli.stub!(:check)
90
+ @cli.should_receive(:check_for_associated_ssh_key)
91
+ @cli.reauthorize
92
+ end
93
+ it "updates saved credentials" do
94
+ Netrc.read(@cli.netrc_path)["api.#{@cli.host}"].should == ['new_user', 'new_password']
95
+ end
96
+ it "returns environment variable credentials" do
97
+ @cli.read_credentials.should == ['', ENV['HEROKU_API_KEY']]
98
+ end
99
+ end
100
+
101
+ context "logout" do
102
+ before do
103
+ @cli.logout
104
+ end
105
+ it "should delete saved credentials" do
106
+ File.exists?(@cli.legacy_credentials_path).should be_false
107
+ Netrc.read(@cli.netrc_path)["api.#{@cli.host}"].should be_nil
108
+ end
109
+ end
110
+ end
111
+
112
+ it "asks for credentials when the file doesn't exist" do
113
+ @cli.delete_credentials
114
+ @cli.should_receive(:ask_for_credentials).and_return(["u", "p"])
115
+ @cli.should_receive(:check_for_associated_ssh_key)
116
+ @cli.user.should == 'u'
117
+ @cli.password.should == 'p'
118
+ end
119
+
120
+ it "writes credentials and uploads authkey when credentials are saved" do
121
+ @cli.stub!(:credentials)
122
+ @cli.stub!(:check)
123
+ @cli.stub!(:ask_for_credentials).and_return("username", "apikey")
124
+ @cli.should_receive(:write_credentials)
125
+ @cli.should_receive(:check_for_associated_ssh_key)
126
+ @cli.ask_for_and_save_credentials
127
+ end
128
+
129
+ it "save_credentials deletes the credentials when the upload authkey is unauthorized" do
130
+ @cli.stub!(:write_credentials)
131
+ @cli.stub!(:retry_login?).and_return(false)
132
+ @cli.stub!(:ask_for_credentials).and_return("username", "apikey")
133
+ @cli.stub!(:check) { raise Heroku::API::Errors::Unauthorized.new("Login Failed", Excon::Response.new) }
134
+ @cli.should_receive(:delete_credentials)
135
+ lambda { @cli.ask_for_and_save_credentials }.should raise_error(SystemExit)
136
+ end
137
+
138
+ it "asks for login again when not authorized, for three times" do
139
+ @cli.stub!(:read_credentials)
140
+ @cli.stub!(:write_credentials)
141
+ @cli.stub!(:delete_credentials)
142
+ @cli.stub!(:ask_for_credentials).and_return("username", "apikey")
143
+ @cli.stub!(:check) { raise Heroku::API::Errors::Unauthorized.new("Login Failed", Excon::Response.new) }
144
+ @cli.should_receive(:ask_for_credentials).exactly(3).times
145
+ lambda { @cli.ask_for_and_save_credentials }.should raise_error(SystemExit)
146
+ end
147
+
148
+ it "deletes the credentials file" do
149
+ FileUtils.mkdir_p(File.dirname(@cli.legacy_credentials_path))
150
+ File.open(@cli.legacy_credentials_path, "w") do |file|
151
+ file.puts "legacy_user\nlegacy_pass"
152
+ end
153
+ FileUtils.should_receive(:rm_f).with(@cli.legacy_credentials_path)
154
+ @cli.delete_credentials
155
+ end
156
+
157
+ it "writes the login information to the credentials file for the 'heroku login' command" do
158
+ @cli.stub!(:ask_for_credentials).and_return(['one', 'two'])
159
+ @cli.stub!(:check)
160
+ @cli.should_receive(:check_for_associated_ssh_key)
161
+ @cli.reauthorize
162
+ Netrc.read(@cli.netrc_path)["api.#{@cli.host}"].should == (['one', 'two'])
163
+ end
164
+
165
+ it "migrates long api keys to short api keys" do
166
+ @cli.delete_credentials
167
+ api_key = "7e262de8cac430d8a250793ce8d5b334ae56b4ff15767385121145198a2b4d2e195905ef8bf7cfc5"
168
+ @cli.netrc["api.#{@cli.host}"] = ["user", api_key]
169
+
170
+ @cli.get_credentials.should == ["user", api_key[0,40]]
171
+ %w{api code}.each do |section|
172
+ Netrc.read(@cli.netrc_path)["#{section}.#{@cli.host}"].should == ["user", api_key[0,40]]
173
+ end
174
+ end
175
+
176
+ describe "automatic key uploading" do
177
+ before(:each) do
178
+ FileUtils.mkdir_p("#{@cli.home_directory}/.ssh")
179
+ @cli.stub!(:ask_for_credentials).and_return("username", "apikey")
180
+ end
181
+
182
+ describe "an account with existing keys" do
183
+ before :each do
184
+ @api = mock(Object)
185
+ @response = mock(Object)
186
+ @response.should_receive(:body).and_return(['existingkeys'])
187
+ @api.should_receive(:get_keys).and_return(@response)
188
+ @cli.should_receive(:api).and_return(@api)
189
+ end
190
+
191
+ it "should not do anything if the account already has keys" do
192
+ @cli.should_not_receive(:associate_key)
193
+ @cli.check_for_associated_ssh_key
194
+ end
195
+ end
196
+
197
+ describe "an account with no keys" do
198
+ before :each do
199
+ @api = mock(Object)
200
+ @response = mock(Object)
201
+ @response.should_receive(:body).and_return([])
202
+ @api.should_receive(:get_keys).and_return(@response)
203
+ @cli.should_receive(:api).and_return(@api)
204
+ end
205
+
206
+ describe "with zero public keys" do
207
+ it "should ask to generate a key" do
208
+ @cli.should_receive(:ask).and_return("y")
209
+ @cli.should_receive(:generate_ssh_key).with("id_rsa")
210
+ @cli.should_receive(:associate_key).with("#{@cli.home_directory}/.ssh/id_rsa.pub")
211
+ @cli.check_for_associated_ssh_key
212
+ end
213
+ end
214
+
215
+ describe "with one public key" do
216
+ before(:each) { FileUtils.touch("#{@cli.home_directory}/.ssh/id_rsa.pub") }
217
+ after(:each) { FileUtils.rm("#{@cli.home_directory}/.ssh/id_rsa.pub") }
218
+
219
+ it "should upload the key" do
220
+ @cli.should_receive(:associate_key).with("#{@cli.home_directory}/.ssh/id_rsa.pub")
221
+ @cli.check_for_associated_ssh_key
222
+ end
223
+ end
224
+
225
+ describe "with many public keys" do
226
+ before(:each) do
227
+ FileUtils.touch("#{@cli.home_directory}/.ssh/id_rsa.pub")
228
+ FileUtils.touch("#{@cli.home_directory}/.ssh/id_rsa2.pub")
229
+ end
230
+
231
+ after(:each) do
232
+ FileUtils.rm("#{@cli.home_directory}/.ssh/id_rsa.pub")
233
+ FileUtils.rm("#{@cli.home_directory}/.ssh/id_rsa2.pub")
234
+ end
235
+
236
+ it "should ask which key to upload" do
237
+ File.open("#{@cli.home_directory}/.ssh/id_rsa.pub", "w") { |f| f.puts }
238
+ @cli.should_receive(:associate_key).with("#{@cli.home_directory}/.ssh/id_rsa2.pub")
239
+ @cli.should_receive(:ask).and_return("2")
240
+ @cli.check_for_associated_ssh_key
241
+ end
242
+ end
243
+ end
244
+ end
245
+ end
246
+ end
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+ require "heroku/client/heroku_postgresql"
3
+ require "digest"
4
+
5
+ describe Heroku::Client::HerokuPostgresql do
6
+
7
+ include Heroku::Helpers
8
+
9
+ let(:url) { 'postgres://somewhere/somedb' }
10
+ let(:url_sha) { Digest::SHA2.hexdigest url }
11
+ let(:client) { Heroku::Client::HerokuPostgresql.new(url) }
12
+
13
+ it "sends an ingress request to the client" do
14
+ url = "https://shogun.heroku.com/client/v10/databases/#{url_sha}/ingress"
15
+
16
+ stub_request(:put, url).to_return(
17
+ :body => json_encode({"message" => "ok"}),
18
+ :status => 200
19
+ )
20
+
21
+ client.ingress
22
+
23
+ a_request(:put, url).should have_been_made.once
24
+ end
25
+
26
+ it "retries on error, then raises" do
27
+ url = "https://shogun.heroku.com/client/v10/databases/#{url_sha}"
28
+ stub_request(:get, url).to_return(:body => "error", :status => 500)
29
+ client.stub(:sleep)
30
+ lambda { client.get_database }.should raise_error RestClient::InternalServerError
31
+ a_request(:get, url).should have_been_made.times(4)
32
+ end
33
+
34
+ end
@@ -0,0 +1,43 @@
1
+ require "spec_helper"
2
+ require "heroku/client/pgbackups"
3
+ require "heroku/helpers"
4
+
5
+ describe Heroku::Client::Pgbackups do
6
+
7
+ include Heroku::Helpers
8
+
9
+ let(:path) { "http://id:password@pgbackups.heroku.com" }
10
+ let(:client) { Heroku::Client::Pgbackups.new path+'/api' }
11
+ let(:transfer_path) { path + '/client/transfers' }
12
+
13
+ describe "api" do
14
+ let(:version) { Heroku::Client.version }
15
+
16
+ it 'still has a heroku gem version' do
17
+ version.should be
18
+ version.split(/\./).first.to_i.should >= 2
19
+ end
20
+
21
+ it 'includes the heroku gem version' do
22
+ stub_request(:get, transfer_path)
23
+ client.get_transfers
24
+ a_request(:get, transfer_path).with(
25
+ :headers => {'X-Heroku-Gem-Version' => version}
26
+ ).should have_been_made.once
27
+ end
28
+ end
29
+
30
+ describe "create transfers" do
31
+ it "sends a request to the client" do
32
+ stub_request(:post, transfer_path).to_return(
33
+ :body => json_encode({"message" => "success"}),
34
+ :status => 200
35
+ )
36
+
37
+ client.create_transfer("postgres://from", "postgres://to", "FROMNAME", "TO_NAME")
38
+
39
+ a_request(:post, transfer_path).should have_been_made.once
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,62 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "spec_helper"
3
+ require "heroku/client/rendezvous"
4
+ require "support/openssl_mock_helper"
5
+
6
+ describe Heroku::Client, "rendezvous" do
7
+ before do
8
+ @rendezvous = Heroku::Client::Rendezvous.new({
9
+ :rendezvous_url => "https://heroku.local:1234/secret",
10
+ :output => $stdout
11
+ })
12
+ end
13
+ context "fixup" do
14
+ it "null" do
15
+ @rendezvous.send(:fixup, nil).should be_nil
16
+ end
17
+ it "an empty string" do
18
+ @rendezvous.send(:fixup, "").should eq ""
19
+ end
20
+ it "hash" do
21
+ @rendezvous.send(:fixup, { :x => :y }).should eq({ :x => :y })
22
+ end
23
+ it "default English UTF-8 data" do
24
+ @rendezvous.send(:fixup, "heroku").should eq "heroku"
25
+ end
26
+ it "default Japanese UTF-8 encoded data" do
27
+ @rendezvous.send(:fixup, "愛しています").should eq "愛しています"
28
+ end
29
+ if RUBY_VERSION >= "1.9"
30
+ it "ISO-8859-1 force-encoded data" do
31
+ @rendezvous.send(:fixup, "Хероку".force_encoding("ISO-8859-1")).should eq "Хероку".force_encoding("UTF-8")
32
+ end
33
+ end
34
+ end
35
+ context "with mock ssl" do
36
+ before :each do
37
+ mock_openssl
38
+ @ssl_socket_mock.should_receive(:puts).with("secret")
39
+ @ssl_socket_mock.should_receive(:readline).and_return(nil)
40
+ end
41
+ it "should connect to host:post" do
42
+ TCPSocket.should_receive(:open).with("heroku.local", 1234).and_return(@tcp_socket_mock)
43
+ IO.stub(:select).and_return(nil)
44
+ @ssl_socket_mock.stub(:write)
45
+ @ssl_socket_mock.stub(:flush) { raise Timeout::Error }
46
+ lambda { @rendezvous.start }.should raise_error(Timeout::Error)
47
+ end
48
+ it "should callback on_connect" do
49
+ @rendezvous.on_connect do
50
+ raise "on_connect"
51
+ end
52
+ TCPSocket.should_receive(:open).and_return(@tcp_socket_mock)
53
+ lambda { @rendezvous.start }.should raise_error("on_connect")
54
+ end
55
+ it "should fixup received data" do
56
+ TCPSocket.should_receive(:open).and_return(@tcp_socket_mock)
57
+ @ssl_socket_mock.should_receive(:readpartial).and_return("The quick brown fox jumps over the lazy dog")
58
+ @rendezvous.stub(:fixup) { |data| raise "received: #{data}" }
59
+ lambda { @rendezvous.start }.should raise_error("received: The quick brown fox jumps over the lazy dog")
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+ require "heroku/client/ssl_endpoint"
3
+
4
+ describe Heroku::Client, "ssl endpoints" do
5
+ before do
6
+ @client = Heroku::Client.new(nil, nil)
7
+ end
8
+
9
+ it "adds an ssl endpoint" do
10
+ stub_request(:post, "https://api.heroku.com/apps/myapp/ssl-endpoints").
11
+ with(:body => { :accept => "json", :pem => "pem content", :key => "key content" }).
12
+ to_return(:body => %{ {"cname": "tokyo-1050" } })
13
+ @client.ssl_endpoint_add("myapp", "pem content", "key content").should == { "cname" => "tokyo-1050" }
14
+ end
15
+
16
+ it "gets info on an ssl endpoint" do
17
+ stub_request(:get, "https://api.heroku.com/apps/myapp/ssl-endpoints/tokyo-1050").
18
+ to_return(:body => %{ {"cname": "tokyo-1050" } })
19
+ @client.ssl_endpoint_info("myapp", "tokyo-1050").should == { "cname" => "tokyo-1050" }
20
+ end
21
+
22
+ it "lists ssl endpoints for an app" do
23
+ stub_request(:get, "https://api.heroku.com/apps/myapp/ssl-endpoints").
24
+ to_return(:body => %{ [{"cname": "tokyo-1050" }, {"cname": "tokyo-1051" }] })
25
+ @client.ssl_endpoint_list("myapp").should == [
26
+ { "cname" => "tokyo-1050" },
27
+ { "cname" => "tokyo-1051" },
28
+ ]
29
+ end
30
+
31
+ it "removes an ssl endpoint" do
32
+ stub_request(:delete, "https://api.heroku.com/apps/myapp/ssl-endpoints/tokyo-1050")
33
+ @client.ssl_endpoint_remove("myapp", "tokyo-1050")
34
+ end
35
+
36
+ it "rolls back an ssl endpoint" do
37
+ stub_request(:post, "https://api.heroku.com/apps/myapp/ssl-endpoints/tokyo-1050/rollback").
38
+ to_return(:body => %{ {"cname": "tokyo-1050" } })
39
+ @client.ssl_endpoint_rollback("myapp", "tokyo-1050").should == { "cname" => "tokyo-1050" }
40
+ end
41
+
42
+ it "updates an ssl endpoint" do
43
+ stub_request(:put, "https://api.heroku.com/apps/myapp/ssl-endpoints/tokyo-1050").
44
+ with(:body => { :accept => "json", :pem => "pem content", :key => "key content" }).
45
+ to_return(:body => %{ {"cname": "tokyo-1050" } })
46
+ @client.ssl_endpoint_update("myapp", "tokyo-1050", "pem content", "key content").should == { "cname" => "tokyo-1050" }
47
+ end
48
+ end