blob: 6379e71a8b2f8a8ff372cef4b8f55c3ff164f856 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#! /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
|