/usr/share/puppet/modules.available/camptocamp-openssl/spec/unit/puppet/type/x509_request_spec.rb is in puppet-module-camptocamp-openssl 1.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | require 'puppet'
require 'puppet/type/x509_request'
describe Puppet::Type.type(:x509_request) do
subject { Puppet::Type.type(:x509_request).new(:path => '/tmp/foo.csr') }
it 'should not accept a non absolute path' do
expect {
Puppet::Type.type(:x509_request).new(:path => 'foo')
}.to raise_error(Puppet::Error, /Path must be absolute: foo/)
end
it 'should accept ensure' do
subject[:ensure] = :present
expect(subject[:ensure]).to eq(:present)
end
it 'should accept valid private key' do
subject[:private_key] = '/tmp/foo.key'
expect(subject[:private_key]).to eq('/tmp/foo.key')
end
it 'should not accept non absolute private key' do
expect {
subject[:private_key] = 'foo.key'
}.to raise_error(Puppet::Error, /Path must be absolute: foo\.key/)
end
it 'should accept valid template' do
subject[:template] = '/tmp/foo.cnf'
expect(subject[:template]).to eq('/tmp/foo.cnf')
end
it 'should not accept non absolute template' do
expect {
subject[:template] = 'foo.cnf'
}.to raise_error(Puppet::Error, /Path must be absolute: foo\.cnf/)
end
it 'should accept a password' do
subject[:password] = 'foox2$bar'
expect(subject[:password]).to eq('foox2$bar')
end
it 'should accept a valid force parameter' do
subject[:force] = true
expect(subject[:force]).to eq(:true)
end
it 'should not accept a bad force parameter' do
expect {
subject[:force] = :foo
}.to raise_error(Puppet::Error, /Invalid value :foo/)
end
it 'should accept a valid authentication' do
subject[:authentication] = :rsa
expect(subject[:authentication]).to eq(:rsa)
subject[:authentication] = :dsa
expect(subject[:authentication]).to eq(:dsa)
end
it 'should not accept an invalid authentication' do
expect {
subject[:authentication] = :foo
}.to raise_error(Puppet::Error, /Invalid value :foo/)
end
end
|