Sha256: 96c38336796b475b94276ebde70d74b6e2c922b2f039df83d529a7b381f02108

Contents?: true

Size: 880 Bytes

Versions: 326

Compression:

Stored size: 880 Bytes

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/indirector/key/disabled_ca'

describe Puppet::SSL::Key::DisabledCa do
  def request(type, remote)
    r = Puppet::Indirector::Request.new(:key, 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::Key.indirection.terminus(:file).expects(name)
        subject.send(name, request(name, false))
      end
    end
  end
end

Version data entries

326 entries across 326 versions & 2 rubygems

Version Path
puppet-5.5.12 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.12-universal-darwin spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.10 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.10-x86-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.10-x64-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.10-universal-darwin spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.8 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.8-x86-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.8-x64-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.8-universal-darwin spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.7 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.7-x86-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.7-x64-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.7-universal-darwin spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.6 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.6-x86-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.6-x64-mingw32 spec/unit/indirector/key/disabled_ca_spec.rb
puppet-5.5.6-universal-darwin spec/unit/indirector/key/disabled_ca_spec.rb