diff options
author | Nimisha Sharad <nimisha.sharad@msystechnologies.com> | 2017-07-26 21:55:32 +0530 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2017-07-26 12:25:32 -0400 |
commit | c2047dde3ecd39188ac3fd5e367613d0b5e4af64 (patch) | |
tree | 4963e50ca89399a9224360169662c08cd47daba9 /spec | |
parent | 7d7cb3e3d7a22908e80dcd8f8541e5537a1b1629 (diff) | |
download | chef-c2047dde3ecd39188ac3fd5e367613d0b5e4af64.tar.gz |
[MSYS-629] Added username/password validation for elevated option (#6293)
* Added username/password validation for elevated option with specs
Signed-off-by: nimisha <nimisha.sharad@clogeny.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/resource/execute_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/unit/resource/execute_spec.rb b/spec/unit/resource/execute_spec.rb index 69e4e91f2a..575c80ba2f 100644 --- a/spec/unit/resource/execute_spec.rb +++ b/spec/unit/resource/execute_spec.rb @@ -77,7 +77,7 @@ describe Chef::Resource::Execute do shared_examples_for "it received invalid credentials" do describe "the validation method" do it "should raise an error" do - expect { execute_resource.validate_identity_platform(username, password, domain) }.to raise_error(ArgumentError) + expect { execute_resource.validate_identity_platform(username, password, domain, elevated) }.to raise_error(ArgumentError) end end end @@ -113,6 +113,7 @@ describe Chef::Resource::Execute do context "when a valid username is specified" do let(:username) { "starchild" } + let(:elevated) { false } context "when a valid domain is specified" do let(:domain) { "mothership" } @@ -129,6 +130,7 @@ describe Chef::Resource::Execute do context "when the domain is not specified" do let(:domain) { nil } + let(:elevated) { false } context "when the password is not specified" do let(:password) { nil } @@ -179,6 +181,24 @@ describe Chef::Resource::Execute do it_behaves_like "it received invalid username and domain" end end + + context "when elevated is passed" do + let(:elevated) { true } + + context "when username and password are not passed" do + let(:username) { nil } + let(:domain) { nil } + let(:password) { nil } + it_behaves_like "it received invalid credentials" + end + + context "when username and password are passed" do + let(:username) { "user" } + let(:domain) { nil } + let(:password) { "we.funk!" } + it_behaves_like "it received valid credentials" + end + end end context "when not running on Windows" do |