From b0da090723a54821d989939d2cede1aac353feff Mon Sep 17 00:00:00 2001 From: Jonathan Leroy Date: Sat, 31 Oct 2020 14:09:54 +0100 Subject: [PATCH] Add test for alias zones --- tests/config/unknown-source-zone.yaml | 9 +++++++-- tests/test_octodns_manager.py | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/config/unknown-source-zone.yaml b/tests/config/unknown-source-zone.yaml index 313853e..a3940ff 100644 --- a/tests/config/unknown-source-zone.yaml +++ b/tests/config/unknown-source-zone.yaml @@ -9,5 +9,10 @@ providers: directory: env/YAML_TMP_DIR zones: unit.tests.: - alias: unit-source.tests. - + sources: + - in + targets: + - dump + + alias.tests.: + alias: does-not-exists.tests. diff --git a/tests/test_octodns_manager.py b/tests/test_octodns_manager.py index b99e460..084ad08 100644 --- a/tests/test_octodns_manager.py +++ b/tests/test_octodns_manager.py @@ -167,6 +167,21 @@ class TestManager(TestCase): .sync(eligible_targets=['foo']) self.assertEquals(0, tc) + def test_aliases(self): + with TemporaryDirectory() as tmpdir: + environ['YAML_TMP_DIR'] = tmpdir.dirname + # Only allow a target that doesn't exist + tc = Manager(get_config_filename('simple-alias-zone.yaml')) \ + .sync() + self.assertEquals(0, tc) + + with self.assertRaises(ManagerException) as ctx: + tc = Manager(get_config_filename('unknown-source-zone.yaml')) \ + .sync() + self.assertEquals('Invalid alias zone alias.tests.: source zone ' + 'does-not-exists.tests. does not exist', + text_type(ctx.exception)) + def test_compare(self): with TemporaryDirectory() as tmpdir: environ['YAML_TMP_DIR'] = tmpdir.dirname