Browse Source

More YamlProvider details testing

pull/1048/head
Ross McFarland 2 years ago
parent
commit
61d3ed884a
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
2 changed files with 28 additions and 0 deletions
  1. +5
    -0
      tests/config/split/unit.tests.yaml
  2. +23
    -0
      tests/test_octodns_provider_yaml.py

+ 5
- 0
tests/config/split/unit.tests.yaml View File

@ -0,0 +1,5 @@
---
only-zone-file:
type: TXT
value: Only included when zone file processing is enabled

+ 23
- 0
tests/test_octodns_provider_yaml.py View File

@ -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))


Loading…
Cancel
Save