additional_cfgdirs=self.test_cfg_dir, additional_stems='test',
verbose=self.verbose,
)
- LOG.debug("DpxPuppetConfig %%r: %r", cfg)
- LOG.debug("DpxPuppetConfig %%s:\n%s", str(cfg))
+ LOG.debug("DpxPuppetConfig %%r: {!r}".format(cfg))
+ if self.verbose > 2:
+ LOG.debug("DpxPuppetConfig %%s:\n{}".format(cfg))
# -------------------------------------------------------------------------
def test_read_config(self):
self.assertIsInstance(value_got, Path)
self.assertEqual(value_got, expected)
+ test_data = (
+ ('mail_from', 'puppet@pixelpark.com'),
+ ('mail_recipients', ['frank@brehm-online.com', 'frank.brehm@pixelpark.com']),
+ ('mail_cc', ['solution@pixelpark.com']),
+ ('reply_to', 'solution@pixelpark.com'),
+ ('mail_method', 'sendmail'),
+ )
+
+ for pair in test_data:
+ prop_name = pair[0]
+ expected = pair[1]
+ LOG.debug("Expecting cfg.{k}: {exp!r}.".format(k=prop_name, exp=expected))
+ value_got = getattr(cfg, prop_name)
+ LOG.debug("Got cfg.{k}: {val!r}.".format(k=prop_name, val=value_got))
+ self.assertEqual(value_got, expected)
+
# =============================================================================
if __name__ == '__main__':
import sys
import logging
+from pathlib import Path
+
try:
import unittest2 as unittest
except ImportError:
# -------------------------------------------------------------------------
def setUp(self):
- pass
+ self.test_dir = Path(__file__).parent.resolve()
+ self.base_dir = self.test_dir.parent
+ self.test_cfg_dir = self.test_dir / 'test-config'
+ self._appname = 'test_app'
# -------------------------------------------------------------------------
def test_import(self):
quiet = True
app = BaseDPXPuppetApplication(
- appname=self.appname, quiet=quiet, verbose=self.verbose)
+ appname=self.appname, quiet=quiet, verbose=self.verbose,
+ additional_cfgdirs=self.test_cfg_dir)
LOG.debug("Drawing lines ...")
app.empty_line()
app.line(linechar='#', color='CYAN')
app.line(width=20)
- LOG.debug("BaseDPXPuppetApplication %%r: %r", app)
+ LOG.debug("BaseDPXPuppetApplication %%r: {!r}".format(app))
app.empty_line()
- LOG.debug("BaseDPXPuppetApplication %%s: %s", str(app))
+ if self.verbose > 2:
+ LOG.debug("BaseDPXPuppetApplication %%s:\n{}".format(app))
# =============================================================================