Skip to content

Commit

Permalink
adding test for generate_site_pp function that now has a default pupp…
Browse files Browse the repository at this point in the history
…et base class to apply to each role
  • Loading branch information
sherzberg committed Jun 23, 2013
1 parent 0929c54 commit e20b44c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
29 changes: 29 additions & 0 deletions spec/puppet_generate_site_pp.py
@@ -0,0 +1,29 @@
from pspec import describe
from attest import assert_hook
from fabric.api import env
from loom.puppet import generate_site_pp, get_puppetmaster_host
from mock import patch


with describe('generate_site_pp'):
def it_creates_an_include_statement_for_each_role():
env.roledefs = {
'app': 'server.example.com',
'db': 'server.example.com',
}
env.host_string = 'server.example.com'
site_pp = generate_site_pp()
assert 'include "roles::app"' in site_pp
assert 'include "roles::db"' in site_pp

with describe('generate_site_pp'):
def it_creates_an_include_statement_for_each_role_and_puppet_base():
env.roledefs = {
'app': 'server.example.com',
}
env.host_string = 'server.example.com'
env.loom_puppet_base_class = 'roles::mybase'
site_pp = generate_site_pp()

assert 'include "roles::app"' in site_pp
assert 'include "roles::mybase"' in site_pp
11 changes: 0 additions & 11 deletions spec/puppet_spec.py
Expand Up @@ -5,17 +5,6 @@
from mock import patch


with describe('generate_site_pp'):
def it_creates_an_include_statement_for_each_role():
env.roledefs = {
'app': 'server.example.com',
'db': 'server.example.com',
}
env.host_string = 'server.example.com'
site_pp = generate_site_pp()
assert 'include "roles::app"' in site_pp
assert 'include "roles::db"' in site_pp

with describe('get_puppetmaster_host'):
def it_get_puppetmaster_from_env_single_host():
newenv = {'puppetmaster_host': 'master.example.com'}
Expand Down

0 comments on commit e20b44c

Please sign in to comment.