Skip to content

Commit 97227de

Browse files
committed
Add acceptance test for PKCS#12 generation
1 parent c8b1a2a commit 97227de

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

examples/export_pkcs12_from_key.pp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
include openssl
2+
openssl::certificate::x509 { 'foo.example.com':
3+
ensure => present,
4+
country => 'CH',
5+
organization => 'Example.com',
6+
commonname => 'foo.example.com',
7+
base_dir => '/tmp',
8+
owner => 'nobody',
9+
password => 'mahje1Qu',
10+
# This is just to speed up CI - use 2048 or more in production
11+
key_size => 1024,
12+
}
13+
-> openssl::export::pkcs12 { 'export.pkcs12':
14+
ensure => 'present',
15+
basedir => '/tmp',
16+
pkey => '/tmp/foo.example.com.key',
17+
cert => '/tmp/foo.example.com.crt',
18+
in_pass => 'mahje1Qu',
19+
out_pass => 'mahje1Qu',
20+
}

spec/acceptance/pkcs12_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper_acceptance'
4+
5+
describe 'pkcs12 example' do
6+
it_behaves_like 'the example', 'export_pkcs12_from_key.pp' do
7+
it { expect(file('/tmp/foo.example.com.crt')).to be_file.and(have_attributes(owner: 'nobody', group: 'root')) }
8+
it { expect(file('/tmp/foo.example.com.key')).to be_file.and(have_attributes(owner: 'nobody', group: 'root')) }
9+
it { expect(file('/tmp/export.pkcs12.p12')).to be_file.and(have_attributes(owner: 'root', group: 'root')) }
10+
end
11+
describe file('/tmp/export.pkcs12.p12') do
12+
its(:size) { is_expected.to be > 0 }
13+
end
14+
end

0 commit comments

Comments
 (0)