Skip to content

Commit

Permalink
Merge ec0959a into 9bc7691
Browse files Browse the repository at this point in the history
  • Loading branch information
gionaufal committed Aug 7, 2019
2 parents 9bc7691 + ec0959a commit a1ca12f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/suse/connect/cli.rb
Expand Up @@ -42,7 +42,7 @@ def execute! # rubocop:disable MethodLength, CyclomaticComplexity, PerceivedComp
elsif @config.token && @config.instance_data_file
log.error 'Please use either --regcode or --instance-data'
exit(1)
elsif @config.url_default? && !@config.token && !status.activated_base_product?
elsif @config.url_default? && !@config.token && !@config.product
puts @opts
exit(1)
else
Expand Down
7 changes: 6 additions & 1 deletion spec/connect/cli_spec.rb
Expand Up @@ -119,7 +119,6 @@

context 'when the system has no activated base product' do
it 'shows a properly rendered help page' do
expect_any_instance_of(Status).to receive(:activated_base_product?).and_return(false)
expect_any_instance_of(Client).not_to receive(:register!)
expect_any_instance_of(described_class).to receive(:puts) do |option_parser|
expect(option_parser.instance_variable_get(:@opts).to_s.split("\n").map(&:length)).to all be <= 80
Expand All @@ -139,6 +138,12 @@
expect_any_instance_of(SUSE::Connect::Config).to receive(:write!)
cli.execute!
end

it 'registers the system if using a configured proxy' do
allow_any_instance_of(SUSE::Connect::Config).to receive(:url_default?).and_return(false)
expect_any_instance_of(Client).to receive(:register!)
cli.execute!
end
end

it 'requires either --regcode or --url (regcode-less SMT registration) but respects config attributes' do
Expand Down

0 comments on commit a1ca12f

Please sign in to comment.