Sha256: 370e80c7bb3f93e0fefabce6209dca9d332fb8cbd3d4063f128d22546b80f695

Contents?: true

Size: 951 Bytes

Versions: 10

Compression:

Stored size: 951 Bytes

Contents

#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'puppet/indirector/certificate_request/disabled_ca'

describe Puppet::SSL::CertificateRequest::DisabledCa do
  def request(type, remote)
    r = Puppet::Indirector::Request.new(:certificate_request, type, "foo.com", nil)
    if remote
      r.ip   = '10.0.0.1'
      r.node = 'agent.example.com'
    end
    r
  end

  context "when not a CA" do
    before :each do
      Puppet[:ca] = false
      Puppet::SSL::Host.ca_location = :none
    end

    [:find, :head, :search, :save, :destroy].each do |name|
      it "should fail remote #{name} requests" do
        expect { subject.send(name, request(name, true)) }.
          to raise_error Puppet::Error, /is not a CA/
      end

      it "should forward local #{name} requests" do
        Puppet::SSL::CertificateRequest.indirection.terminus(:file).expects(name)
        subject.send(name, request(name, false))
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
puppet-2.7.26 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-2.7.25 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-2.7.24 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-2.7.23 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-2.7.22 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-2.7.21 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-2.7.20 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-2.7.20.rc1 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-3.0.0.rc8 spec/unit/indirector/certificate_request/disabled_ca_spec.rb
puppet-3.0.0.rc7 spec/unit/indirector/certificate_request/disabled_ca_spec.rb