|
|
@ -221,27 +221,47 @@ class TestManager(TestCase): |
|
|
manager = Manager(get_config_filename('simple.yaml')) |
|
|
manager = Manager(get_config_filename('simple.yaml')) |
|
|
|
|
|
|
|
|
with self.assertRaises(Exception) as ctx: |
|
|
with self.assertRaises(Exception) as ctx: |
|
|
manager.dump('unit.tests.', tmpdir.dirname, False, 'nope') |
|
|
|
|
|
|
|
|
manager.dump('unit.tests.', tmpdir.dirname, False, False, |
|
|
|
|
|
'nope') |
|
|
self.assertEquals('Unknown source: nope', ctx.exception.message) |
|
|
self.assertEquals('Unknown source: nope', ctx.exception.message) |
|
|
|
|
|
|
|
|
manager.dump('unit.tests.', tmpdir.dirname, False, 'in') |
|
|
|
|
|
|
|
|
manager.dump('unit.tests.', tmpdir.dirname, False, False, 'in') |
|
|
|
|
|
|
|
|
# make sure this fails with an IOError and not a KeyError when |
|
|
# make sure this fails with an IOError and not a KeyError when |
|
|
# tyring to find sub zones |
|
|
# tyring to find sub zones |
|
|
with self.assertRaises(IOError): |
|
|
with self.assertRaises(IOError): |
|
|
manager.dump('unknown.zone.', tmpdir.dirname, False, 'in') |
|
|
|
|
|
|
|
|
manager.dump('unknown.zone.', tmpdir.dirname, False, False, |
|
|
|
|
|
'in') |
|
|
|
|
|
|
|
|
def test_dump_empty(self): |
|
|
def test_dump_empty(self): |
|
|
with TemporaryDirectory() as tmpdir: |
|
|
with TemporaryDirectory() as tmpdir: |
|
|
environ['YAML_TMP_DIR'] = tmpdir.dirname |
|
|
environ['YAML_TMP_DIR'] = tmpdir.dirname |
|
|
manager = Manager(get_config_filename('simple.yaml')) |
|
|
manager = Manager(get_config_filename('simple.yaml')) |
|
|
|
|
|
|
|
|
manager.dump('empty.', tmpdir.dirname, False, 'in') |
|
|
|
|
|
|
|
|
manager.dump('empty.', tmpdir.dirname, False, False, 'in') |
|
|
|
|
|
|
|
|
with open(join(tmpdir.dirname, 'empty.yaml')) as fh: |
|
|
with open(join(tmpdir.dirname, 'empty.yaml')) as fh: |
|
|
data = safe_load(fh, False) |
|
|
data = safe_load(fh, False) |
|
|
self.assertFalse(data) |
|
|
self.assertFalse(data) |
|
|
|
|
|
|
|
|
|
|
|
def test_dump_split(self): |
|
|
|
|
|
with TemporaryDirectory() as tmpdir: |
|
|
|
|
|
environ['YAML_TMP_DIR'] = tmpdir.dirname |
|
|
|
|
|
manager = Manager(get_config_filename('simple-split.yaml')) |
|
|
|
|
|
|
|
|
|
|
|
with self.assertRaises(Exception) as ctx: |
|
|
|
|
|
manager.dump('unit.tests.', tmpdir.dirname, False, True, |
|
|
|
|
|
'nope') |
|
|
|
|
|
self.assertEquals('Unknown source: nope', ctx.exception.message) |
|
|
|
|
|
|
|
|
|
|
|
manager.dump('unit.tests.', tmpdir.dirname, False, True, 'in') |
|
|
|
|
|
|
|
|
|
|
|
# make sure this fails with an IOError and not a KeyError when |
|
|
|
|
|
# tyring to find sub zones |
|
|
|
|
|
with self.assertRaises(IOError): |
|
|
|
|
|
manager.dump('unknown.zone.', tmpdir.dirname, False, True, |
|
|
|
|
|
'in') |
|
|
|
|
|
|
|
|
def test_validate_configs(self): |
|
|
def test_validate_configs(self): |
|
|
Manager(get_config_filename('simple-validate.yaml')).validate_configs() |
|
|
Manager(get_config_filename('simple-validate.yaml')).validate_configs() |
|
|
|
|
|
|
|
|
|