Sha256: d803e78db441cad6eed42f291d56a61eaaadf82e73545ebdfd1593053f905797

Contents?: true

Size: 964 Bytes

Versions: 234

Compression:

Stored size: 964 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)

    expect(decider.allowed?(csr)).to eq(true)
  end

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

    expect(decider.allowed?(csr)).to eq(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

234 entries across 234 versions & 1 rubygems

Version Path
puppet-5.5.12 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.12-universal-darwin spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.10 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.10-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.10-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.10-universal-darwin spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.8 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.8-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.8-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.8-universal-darwin spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.7 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.7-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.7-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.7-universal-darwin spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.6 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.6-x86-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.6-x64-mingw32 spec/unit/ssl/certificate_authority/autosign_command_spec.rb
puppet-5.5.6-universal-darwin spec/unit/ssl/certificate_authority/autosign_command_spec.rb