rhc 1.11.4 → 1.12.4
Sign up to get free protection for your applications and to get access to all the features.
- data/autocomplete/rhc_bash +39 -23
- data/features/domain.feature +8 -3
- data/features/lib/rhc_helper/commandify.rb +6 -0
- data/features/lib/rhc_helper/domain.rb +1 -1
- data/features/step_definitions/domain_steps.rb +9 -4
- data/lib/rhc/auth/basic.rb +4 -2
- data/lib/rhc/cli.rb +1 -0
- data/lib/rhc/commands/apps.rb +2 -4
- data/lib/rhc/commands/cartridge.rb +1 -0
- data/lib/rhc/commands/domain.rb +25 -11
- data/lib/rhc/commands/port_forward.rb +0 -1
- data/lib/rhc/commands/sshkey.rb +1 -1
- data/lib/rhc/helpers.rb +1 -0
- data/lib/rhc/highline_extensions.rb +2 -1
- data/lib/rhc/output_helpers.rb +21 -0
- data/lib/rhc/rest.rb +4 -2
- data/lib/rhc/rest/api.rb +9 -11
- data/lib/rhc/rest/application.rb +4 -0
- data/lib/rhc/rest/base.rb +11 -1
- data/lib/rhc/rest/cartridge.rb +1 -1
- data/lib/rhc/rest/client.rb +52 -29
- data/lib/rhc/rest/domain.rb +11 -1
- data/lib/rhc/rest/httpclient.rb +125 -0
- data/lib/rhc/rest/mock.rb +32 -8
- data/spec/rhc/auth_spec.rb +29 -22
- data/spec/rhc/command_spec.rb +13 -9
- data/spec/rhc/commands/account_spec.rb +2 -2
- data/spec/rhc/commands/app_spec.rb +9 -9
- data/spec/rhc/commands/authorization_spec.rb +11 -11
- data/spec/rhc/commands/cartridge_spec.rb +3 -3
- data/spec/rhc/commands/domain_spec.rb +51 -1
- data/spec/rhc/commands/logout_spec.rb +3 -3
- data/spec/rhc/commands/port_forward_spec.rb +7 -7
- data/spec/rhc/commands/server_spec.rb +2 -2
- data/spec/rhc/commands/setup_spec.rb +6 -6
- data/spec/rhc/commands/snapshot_spec.rb +10 -10
- data/spec/rhc/helpers_spec.rb +6 -6
- data/spec/rhc/rest_application_spec.rb +11 -11
- data/spec/rhc/rest_client_spec.rb +148 -36
- data/spec/rhc/rest_spec.rb +3 -3
- data/spec/rhc/wizard_spec.rb +20 -20
- data/spec/spec_helper.rb +52 -3
- metadata +5 -4
data/spec/spec_helper.rb
CHANGED
@@ -122,6 +122,54 @@ end
|
|
122
122
|
|
123
123
|
include WebMock::API
|
124
124
|
|
125
|
+
require 'httpclient'
|
126
|
+
require 'webmock/http_lib_adapters/httpclient_adapter'
|
127
|
+
#
|
128
|
+
# Patched from WebMock 1.11, needs to be upstreamed
|
129
|
+
#
|
130
|
+
class WebMockHTTPClient
|
131
|
+
def do_get(req, proxy, conn, stream = false, &block)
|
132
|
+
request_signature = build_request_signature(req, :reuse_existing)
|
133
|
+
|
134
|
+
WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)
|
135
|
+
|
136
|
+
if webmock_responses[request_signature]
|
137
|
+
webmock_response = webmock_responses.delete(request_signature)
|
138
|
+
response = build_httpclient_response(webmock_response, stream, &block)
|
139
|
+
@request_filter.each do |filter|
|
140
|
+
# CHANGED
|
141
|
+
r = filter.filter_response(req, response)
|
142
|
+
res = do_get(req, proxy, conn, stream, &block) if r == :retry
|
143
|
+
# END CHANGES
|
144
|
+
end
|
145
|
+
res = conn.push(response)
|
146
|
+
WebMock::CallbackRegistry.invoke_callbacks(
|
147
|
+
{:lib => :httpclient}, request_signature, webmock_response)
|
148
|
+
res
|
149
|
+
elsif WebMock.net_connect_allowed?(request_signature.uri)
|
150
|
+
# in case there is a nil entry in the hash...
|
151
|
+
webmock_responses.delete(request_signature)
|
152
|
+
|
153
|
+
res = if stream
|
154
|
+
do_get_stream_without_webmock(req, proxy, conn, &block)
|
155
|
+
else
|
156
|
+
do_get_block_without_webmock(req, proxy, conn, &block)
|
157
|
+
end
|
158
|
+
res = conn.pop
|
159
|
+
conn.push(res)
|
160
|
+
if WebMock::CallbackRegistry.any_callbacks?
|
161
|
+
webmock_response = build_webmock_response(res)
|
162
|
+
WebMock::CallbackRegistry.invoke_callbacks(
|
163
|
+
{:lib => :httpclient, :real_request => true}, request_signature,
|
164
|
+
webmock_response)
|
165
|
+
end
|
166
|
+
res
|
167
|
+
else
|
168
|
+
raise WebMock::NetConnectNotAllowedError.new(request_signature)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
125
173
|
def stderr
|
126
174
|
$stderr.rewind
|
127
175
|
# some systems might redirect warnings to stderr
|
@@ -156,7 +204,7 @@ module CommandHelpers
|
|
156
204
|
mock_terminal
|
157
205
|
new_command_runner *args do
|
158
206
|
instance #ensure instance is created before subject :new is mocked
|
159
|
-
subject.
|
207
|
+
subject.stub(:new).and_return(instance)
|
160
208
|
RHC::Commands.to_commander
|
161
209
|
end
|
162
210
|
end
|
@@ -344,10 +392,10 @@ module ClassSpecHelpers
|
|
344
392
|
def expect_multi_ssh(command, hosts, check_error=false)
|
345
393
|
require 'net/ssh/multi'
|
346
394
|
|
347
|
-
session =
|
395
|
+
session = double('Multi::SSH::Session')
|
348
396
|
described_class.any_instance.stub(:requires_ssh_multi!)
|
349
397
|
channels = hosts.inject({}) do |h, (k,v)|
|
350
|
-
c =
|
398
|
+
c = double(:properties => {}, :connection => double(:properties => {}))
|
351
399
|
h[k] = c
|
352
400
|
h
|
353
401
|
end
|
@@ -512,6 +560,7 @@ RSpec.configure do |config|
|
|
512
560
|
config.include(ClassSpecHelpers)
|
513
561
|
config.include(CommandHelpers)
|
514
562
|
config.extend(CommandExampleHelpers)
|
563
|
+
config.backtrace_clean_patterns = [] if ENV['FULL_BACKTRACE']
|
515
564
|
end
|
516
565
|
|
517
566
|
module TestEnv
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 47
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 12
|
9
9
|
- 4
|
10
|
-
version: 1.
|
10
|
+
version: 1.12.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Red Hat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-08-06 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: net-ssh
|
@@ -281,6 +281,7 @@ files:
|
|
281
281
|
- lib/rhc/rest/client.rb
|
282
282
|
- lib/rhc/rest/application.rb
|
283
283
|
- lib/rhc/rest/base.rb
|
284
|
+
- lib/rhc/rest/httpclient.rb
|
284
285
|
- lib/rhc.rb
|
285
286
|
- lib/rhc/autocomplete_templates/bash.erb
|
286
287
|
- lib/rhc/usage_templates/command_syntax_help.erb
|