Skip to content

Commit

Permalink
Add unit test for settings.py header
Browse files Browse the repository at this point in the history
  • Loading branch information
wbclark committed Jul 22, 2021
1 parent b75c086 commit e4e1db8
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions spec/classes/settings_header_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
require 'spec_helper'

describe 'pulpcore' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

context 'default params' do
it { is_expected.to compile.with_all_deps }

it 'adds default header to settings.py' do
is_expected.to contain_concat__fragment('base')
.with_content(
Regexp.new(<<~HEADER.chomp),
################################################################################
# !!! WARNING: DO NOT EDIT THIS FILE !!! #
################################################################################
# File managed by Puppet. #
# Module: pulpcore #
################################################################################
# Not only are your edits likely to be overwritten, there is also a strong #
# possibility of breaking your system if you change configuration here without #
# making required changes elsewhere. Refer to the documentation you used to #
# install Pulpcore to determine the safe and persistent way to modify the #
# configuration. #
################################################################################
CONTENT_HOST =
HEADER
)
end
end

context 'with custom config header strings' do
let :manifest do
<<~PUPPET
class { pulpcore::header_strings:
custom_installer_name => 'my_pulpcore_installer',
custom_settings_explanation => "Don't even think about it."
}
include pulpcore
PUPPET
end

it { is_expected.to compile.with_all_deps }

it 'adds customized header to settings.py' do
is_expected.to contain_concat__fragment('base')
.with_content(
Regexp.new(<<~HEADER.chomp),
################################################################################
# !!! WARNING: DO NOT EDIT THIS FILE !!! #
################################################################################
# File managed by my_pulpcore_installer. #
# Module: pulpcore #
################################################################################
# Don't even think about it. #
################################################################################
CONTENT_HOST =
HEADER
)
end
end
end
end
end

0 comments on commit e4e1db8

Please sign in to comment.