From 61d3ed884adf43a74705a155ce67fd3f9ab763a7 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Fri, 18 Aug 2023 07:39:47 -0700 Subject: [PATCH] More YamlProvider details testing --- tests/config/split/unit.tests.yaml | 5 +++++ tests/test_octodns_provider_yaml.py | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/config/split/unit.tests.yaml diff --git a/tests/config/split/unit.tests.yaml b/tests/config/split/unit.tests.yaml new file mode 100644 index 0000000..e249c43 --- /dev/null +++ b/tests/config/split/unit.tests.yaml @@ -0,0 +1,5 @@ +--- +only-zone-file: + type: TXT + value: Only included when zone file processing is enabled + diff --git a/tests/test_octodns_provider_yaml.py b/tests/test_octodns_provider_yaml.py index 6e0a615..4fabb54 100644 --- a/tests/test_octodns_provider_yaml.py +++ b/tests/test_octodns_provider_yaml.py @@ -360,6 +360,7 @@ xn--dj-kia8a: list(provider.list_zones()), ) + # include stuff with .tst AND basic provider.split_extension = '.tst' self.assertEqual( [ @@ -374,6 +375,20 @@ xn--dj-kia8a: list(provider.list_zones()), ) + # only .tst + provider.split_only = True + self.assertEqual( + ['other-ext.split.', 'split-ext.test.', 'sub.split-ext.test.'], + list(provider.list_zones()), + ) + + # only . (and both zone) + provider.split_extension = '.' + self.assertEqual( + ['both.tld.', 'other.split.', 'split.test.', 'sub.split.test.'], + list(provider.list_zones()), + ) + class TestSplitYamlProvider(TestCase): def test_list_all_yaml_files(self): @@ -485,6 +500,14 @@ class TestSplitYamlProvider(TestCase): source.populate(zone) self.assertEqual(20, len(zone.records)) + # temporarily enable zone file processing too, we should see one extra + # record that came from unit.tests. + source.split_only = False + zone_both = Zone('unit.tests.', []) + source.populate(zone_both) + self.assertEqual(21, len(zone_both.records)) + source.split_only = True + source.populate(dynamic_zone) self.assertEqual(5, len(dynamic_zone.records))