rhc 1.27.4 → 1.28.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -214,6 +214,20 @@ describe AllRhcHelpers do
214
214
  end
215
215
  end
216
216
 
217
+ context "with a missing client key file" do
218
+ context "on the command line" do
219
+ let(:arguments){ ['help', '--ssl-client-key-file=not_a_file'] }
220
+ it{ expect{ run }.to exit_with_code(1) }
221
+ it{ run_output.should match("The key 'not_a_file' cannot be loaded: No such") }
222
+ end
223
+ context "via the config" do
224
+ before{ base_config{ |c, d| d.add 'ssl_client_key_file', 'not_a_file' } }
225
+ let(:arguments){ ['help'] }
226
+ it{ expect{ run }.to exit_with_code(1) }
227
+ it{ run_output.should match("The key 'not_a_file' cannot be loaded: No such") }
228
+ end
229
+ end
230
+
217
231
  context 'with a valid --ssl-version' do
218
232
  let(:arguments){ ['help', '--ssl-version=sslv3'] }
219
233
 
@@ -103,6 +103,17 @@ describe RHC::Wizard do
103
103
  end
104
104
  end
105
105
 
106
+ describe "#core_auth" do
107
+ subject{ described_class.new(config, options) }
108
+
109
+ it "should use x509 if certificates are present" do
110
+ options.should_receive(:ssl_client_cert_file).and_return("a cert")
111
+ options.should_receive(:ssl_client_key_file).and_return("a key")
112
+ RHC::Auth::X509.should_receive(:new).exactly(1).times.with(options)
113
+ subject.send(:core_auth)
114
+ end
115
+ end
116
+
106
117
  describe "#login_stage" do
107
118
  let(:user){ 'test_user' }
108
119
  let(:password){ 'test pass' }
@@ -234,6 +245,23 @@ describe RHC::Wizard do
234
245
  options.token.should == token
235
246
  end
236
247
  end
248
+
249
+ context "when the user doesn't want to use tokens" do
250
+ let(:default_options){ {:rhlogin => user, :password => password, :server => server, :use_authorization_tokens => false, :create_token => false} }
251
+ before do
252
+ subject.should_receive(:new_client_for_options).ordered.and_return(rest_client)
253
+ rest_client.should_receive(:api).ordered
254
+ rest_client.should_receive(:user).ordered.and_return(user_obj)
255
+ end
256
+
257
+ it "should skip token generation" do
258
+ subject.should_receive(:say).with(/Skipping token generation/)
259
+ subject.should_receive(:agree).never
260
+
261
+ subject.send(:login_stage).should be_true
262
+ options.token.should be_nil
263
+ end
264
+ end
237
265
  end
238
266
  end
239
267
 
@@ -719,6 +747,9 @@ EOF
719
747
  def type=(type)
720
748
  @table[:type] = type
721
749
  end
750
+ def is_ssh?
751
+ type != 'krb5-principal'
752
+ end
722
753
  end
723
754
 
724
755
  def get_mock_key_data
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: 115
4
+ hash: 109
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 27
9
- - 4
10
- version: 1.27.4
8
+ - 28
9
+ - 5
10
+ version: 1.28.5
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: 2014-07-11 00:00:00 Z
18
+ date: 2014-08-02 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: net-ssh
@@ -289,6 +289,7 @@ files:
289
289
  - lib/rhc/commands/ssh.rb
290
290
  - lib/rhc/commands/apps.rb
291
291
  - lib/rhc/commands/alias.rb
292
+ - lib/rhc/commands/region.rb
292
293
  - lib/rhc/commands/authorization.rb
293
294
  - lib/rhc/commands/sshkey.rb
294
295
  - lib/rhc/commands/app.rb
@@ -320,6 +321,7 @@ files:
320
321
  - lib/rhc/rest/api.rb
321
322
  - lib/rhc/rest/client.rb
322
323
  - lib/rhc/rest/alias.rb
324
+ - lib/rhc/rest/region.rb
323
325
  - lib/rhc/rest/authorization.rb
324
326
  - lib/rhc/rest/mock.rb
325
327
  - lib/rhc/rest/httpclient.rb
@@ -330,6 +332,7 @@ files:
330
332
  - lib/rhc/vendor/zliby.rb
331
333
  - lib/rhc/vendor/sshkey.rb
332
334
  - lib/rhc/auth/token.rb
335
+ - lib/rhc/auth/x509.rb
333
336
  - lib/rhc/auth/basic.rb
334
337
  - lib/rhc/auth/token_store.rb
335
338
  - lib/rhc/helpers.rb
@@ -372,6 +375,7 @@ files:
372
375
  - spec/rhc/commands/app_spec.rb
373
376
  - spec/rhc/commands/snapshot_spec.rb
374
377
  - spec/rhc/commands/ssh_spec.rb
378
+ - spec/rhc/commands/region_spec.rb
375
379
  - spec/rhc/commands/tail_spec.rb
376
380
  - spec/rhc/commands/setup_spec.rb
377
381
  - spec/rhc/commands/alias_spec.rb
@@ -471,6 +475,7 @@ test_files:
471
475
  - spec/rhc/commands/app_spec.rb
472
476
  - spec/rhc/commands/snapshot_spec.rb
473
477
  - spec/rhc/commands/ssh_spec.rb
478
+ - spec/rhc/commands/region_spec.rb
474
479
  - spec/rhc/commands/tail_spec.rb
475
480
  - spec/rhc/commands/setup_spec.rb
476
481
  - spec/rhc/commands/alias_spec.rb