-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit test for settings.py header
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |