diff options
author | nimisha <nimisha.sharad@msystechnologies.com> | 2017-01-27 15:44:48 +0530 |
---|---|---|
committer | nimisha <nimisha.sharad@msystechnologies.com> | 2017-02-02 18:00:37 +0530 |
commit | c39006c5f757281525703d8506bfb6d4e9340082 (patch) | |
tree | 05477983a26f0d2db4bcabceaa9ac6c475c1301e /spec | |
parent | dd75bf444a73bc35c226aabaf4f5ea26b8528285 (diff) | |
download | chef-c39006c5f757281525703d8506bfb6d4e9340082.tar.gz |
Fixed bugs, review comments and specs
Signed-off-by: nimisha <nimisha.sharad@msystechnologies.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/support/shared/functional/execute_resource.rb | 4 | ||||
-rw-r--r-- | spec/support/shared/functional/windows_script.rb | 5 | ||||
-rw-r--r-- | spec/unit/mixin/user_identity_spec.rb | 15 |
3 files changed, 17 insertions, 7 deletions
diff --git a/spec/support/shared/functional/execute_resource.rb b/spec/support/shared/functional/execute_resource.rb index 6561f95ec1..3f9dd8af5c 100644 --- a/spec/support/shared/functional/execute_resource.rb +++ b/spec/support/shared/functional/execute_resource.rb @@ -76,12 +76,12 @@ shared_examples_for "an execute resource that supports alternate user identity" let(:windows_current_user_qualified) { "#{ENV['USERDOMAIN'] || ENV['COMPUTERNAME']}\\#{windows_current_user}" } let(:resource_identity_command) { "powershell.exe -noprofile -command \"import-module microsoft.powershell.utility;([Security.Principal.WindowsPrincipal]([Security.Principal.WindowsIdentity]::GetCurrent())).identity.name | out-file -encoding ASCII '#{script_output_path}'\"" } - let(:execute_resource) { + let(:execute_resource) do resource.user(windows_alternate_user) resource.password(windows_alternate_user_password) resource.send(resource_command_property, resource_identity_command) resource - } + end it "executes the process as an alternate user" do expect(windows_current_user.length).to be > 0 diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb index 4bd6bdf230..8a9a19d4ad 100644 --- a/spec/support/shared/functional/windows_script.rb +++ b/spec/support/shared/functional/windows_script.rb @@ -160,11 +160,6 @@ shared_context Chef::Resource::WindowsScript do end end - context "when a different non-admin user attempts read to access the script" do - let(:file_access_command) { read_access_denied_command } - it_behaves_like "a script whose file system location cannot be accessed by other non-admin users" - end - context "when a different non-admin user attempts write (modify) to access the script" do let(:file_access_command) { modify_access_denied_command } it_behaves_like "a script whose file system location cannot be accessed by other non-admin users" diff --git a/spec/unit/mixin/user_identity_spec.rb b/spec/unit/mixin/user_identity_spec.rb index 799260b25a..790e0a6ab9 100644 --- a/spec/unit/mixin/user_identity_spec.rb +++ b/spec/unit/mixin/user_identity_spec.rb @@ -94,6 +94,21 @@ shared_examples_for "a consumer of the ::Chef::Mixin::UserIdentity mixin" do it_behaves_like "it received valid credentials" end end + + context "when the domain is provided in both username and domain" do + let(:domain) { "some_domain" } + let(:password) { "we.funk!" } + + context "when username is in the form domain\\user" do + let(:username) { "mothership\\starchild" } + it_behaves_like "it received invalid credentials" + end + + context "when username is in the form user@domain" do + let(:username) { "starchild@mothership" } + it_behaves_like "it received invalid credentials" + end + end end context "when the username is not specified" do |