rhc 1.11.4 → 1.12.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/autocomplete/rhc_bash +39 -23
  2. data/features/domain.feature +8 -3
  3. data/features/lib/rhc_helper/commandify.rb +6 -0
  4. data/features/lib/rhc_helper/domain.rb +1 -1
  5. data/features/step_definitions/domain_steps.rb +9 -4
  6. data/lib/rhc/auth/basic.rb +4 -2
  7. data/lib/rhc/cli.rb +1 -0
  8. data/lib/rhc/commands/apps.rb +2 -4
  9. data/lib/rhc/commands/cartridge.rb +1 -0
  10. data/lib/rhc/commands/domain.rb +25 -11
  11. data/lib/rhc/commands/port_forward.rb +0 -1
  12. data/lib/rhc/commands/sshkey.rb +1 -1
  13. data/lib/rhc/helpers.rb +1 -0
  14. data/lib/rhc/highline_extensions.rb +2 -1
  15. data/lib/rhc/output_helpers.rb +21 -0
  16. data/lib/rhc/rest.rb +4 -2
  17. data/lib/rhc/rest/api.rb +9 -11
  18. data/lib/rhc/rest/application.rb +4 -0
  19. data/lib/rhc/rest/base.rb +11 -1
  20. data/lib/rhc/rest/cartridge.rb +1 -1
  21. data/lib/rhc/rest/client.rb +52 -29
  22. data/lib/rhc/rest/domain.rb +11 -1
  23. data/lib/rhc/rest/httpclient.rb +125 -0
  24. data/lib/rhc/rest/mock.rb +32 -8
  25. data/spec/rhc/auth_spec.rb +29 -22
  26. data/spec/rhc/command_spec.rb +13 -9
  27. data/spec/rhc/commands/account_spec.rb +2 -2
  28. data/spec/rhc/commands/app_spec.rb +9 -9
  29. data/spec/rhc/commands/authorization_spec.rb +11 -11
  30. data/spec/rhc/commands/cartridge_spec.rb +3 -3
  31. data/spec/rhc/commands/domain_spec.rb +51 -1
  32. data/spec/rhc/commands/logout_spec.rb +3 -3
  33. data/spec/rhc/commands/port_forward_spec.rb +7 -7
  34. data/spec/rhc/commands/server_spec.rb +2 -2
  35. data/spec/rhc/commands/setup_spec.rb +6 -6
  36. data/spec/rhc/commands/snapshot_spec.rb +10 -10
  37. data/spec/rhc/helpers_spec.rb +6 -6
  38. data/spec/rhc/rest_application_spec.rb +11 -11
  39. data/spec/rhc/rest_client_spec.rb +148 -36
  40. data/spec/rhc/rest_spec.rb +3 -3
  41. data/spec/rhc/wizard_spec.rb +20 -20
  42. data/spec/spec_helper.rb +52 -3
  43. metadata +5 -4
@@ -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.should_receive(:new).any_number_of_times.and_return(instance)
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 = mock('Multi::SSH::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 = stub(:properties => {}, :connection => stub(:properties => {}))
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: 51
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 11
8
+ - 12
9
9
  - 4
10
- version: 1.11.4
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-07-17 00:00:00 Z
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