Sha256: 375fd1ccce6f01f314f34c97cb4ac68f9a2431017b584500b704b36991a9ea1b

Contents?: true

Size: 954 Bytes

Versions: 63

Compression:

Stored size: 954 Bytes

Contents

require 'spec_helper'

require 'puppet/ssl/certificate_authority/autosign_command'

describe Puppet::SSL::CertificateAuthority::AutosignCommand do

  let(:csr) { stub 'csr', :name => 'host', :to_s => 'CSR PEM goes here' }
  let(:decider) { Puppet::SSL::CertificateAuthority::AutosignCommand.new('/autosign/command') }

  it "returns true if the command succeeded" do
    executes_the_command_resulting_in(0)

    decider.allowed?(csr).should == true
  end

  it "returns false if the command failed" do
    executes_the_command_resulting_in(1)

    decider.allowed?(csr).should == false
  end

  def executes_the_command_resulting_in(exitstatus)
    Puppet::Util::Execution.expects(:execute).
      with(['/autosign/command', 'host'],
           has_entries(:stdinfile => anything,
                       :combine => true,
                       :failonfail => false)).
      returns(Puppet::Util::Execution::ProcessOutput.new('', exitstatus))
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
puppet-3.8.1-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.5 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.5-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.5-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.4 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.4-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.4-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.3 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.3-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.3-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.2 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.2-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.2-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.1 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.1-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.1-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.0 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.0-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.7.0-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-3.6.2 spec/unit/ssl/certificate_authority/autosign_command_spec.rb