Skip to content

Commit

Permalink
added rspec for ExternalHttpdAuthentication#configure_ipa_http_service
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed Aug 11, 2017
1 parent 71b068c commit 782e12a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/appliance_console/external_httpd_authentication_spec.rb
@@ -1,6 +1,7 @@
require "active_support/all"
require "appliance_console/external_httpd_authentication"
require "appliance_console/prompts"
require "appliance_console/principal"
require "linux_admin"

describe ApplianceConsole::ExternalHttpdAuthentication do
Expand Down Expand Up @@ -162,4 +163,25 @@
subject.post_activation
end
end

context "#configure_ipa_http_service" do
before do
allow(subject).to receive(:say)
service = double("Principal")
allow(ApplianceConsole::Principal).to receive(:new).and_return(service)
allow(service).to receive(:register)
allow(service).to receive(:name)
allow(FileUtils).to receive(:chown)
allow(FileUtils).to receive(:chmod)
allow(AwesomeSpawn).to receive(:run!).with("/usr/sbin/ipa-getkeytab", anything)
end

it "accept symbol '$' as part of password string" do
subject.instance_variable_set("@password", "$my_password")
expect(AwesomeSpawn).to receive(:run!).exactly(1).with("/usr/bin/kinit",
:params => ["admin"],
:stdin_data => "$my_password")
subject.send(:configure_ipa_http_service)
end
end
end

0 comments on commit 782e12a

Please sign in to comment.