Skip to content
Snippets Groups Projects
Commit 80d4fbbe authored by Mickaël Canévet's avatar Mickaël Canévet
Browse files

Fix unit tests

parent b61e5a9b
No related branches found
No related tags found
No related merge requests found
......@@ -2,9 +2,15 @@ require 'spec_helper'
describe 'postfix::augeas' do
let (:facts) { {
:augeasversion => '1.2.0',
:lsbdistcodename => 'wheezy',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:rubyversion => '1.9.3',
} }
let :pre_condition do
"include ::augeas"
end
it { should contain_augeas__lens('postfix_transport').with(
:ensure => 'present',
......
......@@ -2,9 +2,16 @@ require 'spec_helper'
describe 'postfix::mta' do
let (:facts) { {
:needs_postfix_class_with_params => true,
:lsbdistcodename => 'wheezy',
:osfamily => 'Debian',
} }
let :pre_condition do
"class { 'postfix':
mydestination => 'bar',
mynetworks => 'baz',
relayhost => 'foo',
}"
end
it { should contain_postfix__config('mydestination').with_value('bar') }
it { should contain_postfix__config('mynetworks').with_value('baz') }
......
......@@ -3,9 +3,19 @@ require 'spec_helper'
describe 'postfix::satellite' do
let (:node) { 'foo.example.com' }
let (:facts) { {
:augeasversion => '1.2.0',
:lsbdistcodename => 'wheezy',
:osfamily => 'Debian',
:needs_postfix_class_with_params => true,
:rubyversion => '1.9.3',
} }
let :pre_condition do
" class { 'augeas': }
class { 'postfix':
relayhost => 'foo',
mydestination => 'bar',
mynetworks => 'baz',
}"
end
it { should contain_class('postfix::mta') }
it { should contain_postfix__virtual('@foo.example.com').with(
:ensure => 'present',
......
......@@ -4,6 +4,7 @@ describe 'postfix' do
context 'when using defaults' do
context 'when on Debian' do
let (:facts) { {
:lsbdistcodename => 'wheezy',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:fqdn => 'fqdn.example.com',
......@@ -35,6 +36,7 @@ describe 'postfix' do
context 'when on RedHat' do
let (:facts) { {
:lsbmajdistrelease => '7',
:operatingsystem => 'RedHat',
:osfamily => 'RedHat',
:fqdn => 'fqdn.example.com',
......@@ -72,6 +74,7 @@ describe 'postfix' do
context 'when on Debian' do
context "when setting smtp_listen to 'all'" do
let (:facts) { {
:lsbdistcodename => 'wheezy',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:fqdn => 'fqdn.example.com',
......@@ -139,8 +142,11 @@ describe 'postfix' do
end
context 'when on RedHat' do
let (:facts) { {
:augeasversion => '1.2.0',
:lsbdistcodename => 'wheezy',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:rubyversion => '1.9.7',
:fqdn => 'fqdn.example.com',
} }
context 'when specifying inet_interfaces' do
......@@ -246,6 +252,9 @@ describe 'postfix' do
end
context 'when specifying satellite' do
let (:params) { { :satellite => true, :mydestination => '1.2.3.4', :relayhost => '2.3.4.5' } }
let :pre_condition do
"class { 'augeas': }"
end
it 'should configure all local email to be forwarded to $root_mail_recipient delivered through $relayhost' do
should contain_postfix__config('mydestination').with_value('1.2.3.4')
should contain_postfix__config('mynetworks').with_value('127.0.0.0/8')
......
......@@ -3,9 +3,12 @@ require 'spec_helper'
describe 'postfix::config' do
let (:title) { 'foo' }
let (:facts) { {
:lsbdistcodename => 'wheezy',
:osfamily => 'Debian',
:needs_postfix_class => true,
} }
let :pre_condition do
"class { 'postfix': }"
end
context 'when not passing value' do
it 'should fail' do
......
......@@ -3,9 +3,12 @@ require 'spec_helper'
describe 'postfix::hash' do
let (:title) { '/tmp/foo' }
let (:facts) { {
:lsbdistcodename => 'wheezy',
:osfamily => 'Debian',
:needs_postfix_class => true,
} }
let :pre_condition do
"class { '::postfix': }"
end
context 'when passing wrong type for ensure' do
let (:params) { {
......
......@@ -3,8 +3,13 @@ require 'spec_helper'
describe 'postfix::transport' do
let (:title) { 'foo' }
let (:facts) { {
:augeasversion => '1.2.0',
:osfamily => 'Debian',
:rubyversion => '1.9.3',
} }
let :pre_condition do
"class { 'augeas': }"
end
context 'when sending wrong type for destination' do
let (:params) { {
......
......@@ -3,8 +3,13 @@ require 'spec_helper'
describe 'postfix::virtual' do
let (:title) { 'foo' }
let (:facts) { {
:augeasversion => '1.2.0',
:osfamily => 'Debian',
:rubyversion => '1.9.3',
} }
let :pre_condition do
"class { 'augeas': }"
end
context 'when not sending destination' do
it 'should fail' do
......
include ::augeas
if $::needs_postfix_class {
include ::postfix
}
if $::needs_postfix_class_with_params {
class { '::postfix':
relayhost => 'foo',
mydestination => 'bar',
mynetworks => 'baz',
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment