mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Add tests for Manager.get_zones()
This commit is contained in:
@@ -469,8 +469,8 @@ class Manager(object):
|
||||
|
||||
def get_zone(self, zone_name):
|
||||
if not zone_name[-1] == '.':
|
||||
raise Exception('Invalid zone name {}, missing ending dot'
|
||||
.format(zone_name))
|
||||
raise ManagerException('Invalid zone name {}, missing ending dot'
|
||||
.format(zone_name))
|
||||
|
||||
for name, config in self.config['zones'].items():
|
||||
if name == zone_name:
|
||||
|
@@ -286,6 +286,18 @@ class TestManager(TestCase):
|
||||
.validate_configs()
|
||||
self.assertTrue('unknown source' in text_type(ctx.exception))
|
||||
|
||||
def test_get_zone(self):
|
||||
Manager(get_config_filename('simple.yaml')).get_zone('unit.tests.')
|
||||
|
||||
with self.assertRaises(ManagerException) as ctx:
|
||||
Manager(get_config_filename('simple.yaml')).get_zone('unit.tests')
|
||||
self.assertTrue('missing ending dot' in text_type(ctx.exception))
|
||||
|
||||
with self.assertRaises(ManagerException) as ctx:
|
||||
Manager(get_config_filename('simple.yaml')) \
|
||||
.get_zone('unknown-zone.tests.')
|
||||
self.assertTrue('Unknown zone name' in text_type(ctx.exception))
|
||||
|
||||
def test_populate_lenient_fallback(self):
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
environ['YAML_TMP_DIR'] = tmpdir.dirname
|
||||
@@ -321,8 +333,8 @@ class TestManager(TestCase):
|
||||
with self.assertRaises(ManagerException) as ctx:
|
||||
Manager(get_config_filename('unknown-source-zone.yaml')) \
|
||||
.validate_configs()
|
||||
self.assertTrue('Invalid alias zone' in
|
||||
text_type(ctx.exception))
|
||||
self.assertTrue('Invalid alias zone' in
|
||||
text_type(ctx.exception))
|
||||
|
||||
|
||||
class TestMainThreadExecutor(TestCase):
|
||||
|
Reference in New Issue
Block a user