diff options
author | Collin McNeese <cmcneese@chef.io> | 2021-10-29 16:02:06 -0500 |
---|---|---|
committer | Collin McNeese <cmcneese@chef.io> | 2021-10-29 16:02:06 -0500 |
commit | b72d0c224389f211d18f39b32b28b0ead3b8eff2 (patch) | |
tree | 898bec98641a5aa3ad9180243e06a53b7146d608 /spec | |
parent | 77130d04a66f4b3dbc8833af576181d74118214c (diff) | |
download | chef-b72d0c224389f211d18f39b32b28b0ead3b8eff2.tar.gz |
adds additional properties to rhsm_register resource
Signed-off-by: Collin McNeese <cmcneese@chef.io>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/resource/rhsm_register_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/unit/resource/rhsm_register_spec.rb b/spec/unit/resource/rhsm_register_spec.rb index 7ce76ad908..f3faf13d0f 100644 --- a/spec/unit/resource/rhsm_register_spec.rb +++ b/spec/unit/resource/rhsm_register_spec.rb @@ -158,6 +158,48 @@ describe Chef::Resource::RhsmRegister do end end + context "when a server_url is provided" do + it "returns a command containing the serverurl" do + allow(resource).to receive(:server_url).and_return("https://fqdn.example") + expect(provider.register_command).to match("--serverurl=https://fqdn.example") + end + end + + context "when a base_url is provided" do + it "returns a command containing the baseurl" do + allow(resource).to receive(:base_url).and_return("https://fqdn.example") + expect(provider.register_command).to match("--baseurl=https://fqdn.example") + end + end + + context "when a service_level is provided" do + it "returns a command containing the service level" do + allow(resource).to receive(:service_level).and_return("None") + allow(resource).to receive(:auto_attach).and_return(true) + expect(provider.register_command).to match("--servicelevel=None") + end + + it "raises an exception if auto_attach is not set" do + allow(resource).to receive(:service_level).and_return("None") + allow(resource).to receive(:auto_attach).and_return(nil) + expect { provider.register_command }.to raise_error(RuntimeError) + end + end + + context "when a release is provided" do + it "returns a command containing the release" do + allow(resource).to receive(:release).and_return("8.4") + allow(resource).to receive(:auto_attach).and_return(true) + expect(provider.register_command).to match("--release=8.4") + end + + it "raises an exception if auto_attach is not set" do + allow(resource).to receive(:release).and_return("8.4") + allow(resource).to receive(:auto_attach).and_return(nil) + expect { provider.register_command }.to raise_error(RuntimeError) + end + end + context "when a system_name is not provided" do it "returns a command containing the system name" do allow(resource).to receive(:system_name).and_return(nil) |