Browse Source

Fix Manager ordering assumptions

pull/384/head
Ross McFarland 6 years ago
parent
commit
db8de8acb8
No known key found for this signature in database GPG Key ID: 61C10C4FC8FE4A89
3 changed files with 33 additions and 21 deletions
  1. +28
    -0
      tests/config/provider-problems.yaml
  2. +0
    -16
      tests/config/unknown-provider.yaml
  3. +5
    -5
      tests/test_octodns_manager.py

+ 28
- 0
tests/config/provider-problems.yaml View File

@ -0,0 +1,28 @@
providers:
yaml:
class: octodns.provider.yaml.YamlProvider
directory: ./config
simple_source:
class: helpers.SimpleSource
zones:
missing.sources.:
targets:
- yaml
missing.targets.:
sources:
- yaml
unknown.source.:
sources:
- not-there
targets:
- yaml
unknown.target.:
sources:
- yaml
targets:
- not-there-either
not.targetable.:
sources:
- yaml
targets:
- simple_source

+ 0
- 16
tests/config/unknown-provider.yaml View File

@ -5,24 +5,8 @@ providers:
simple_source:
class: helpers.SimpleSource
zones:
missing.sources.:
targets:
- yaml
missing.targets.:
sources:
- yaml
unknown.source.:
sources:
- not-there
targets:
- yaml
unknown.target.:
sources:
- yaml
targets:
- not-there-either
not.targetable.:
sources:
- yaml
targets:
- simple_source

+ 5
- 5
tests/test_octodns_manager.py View File

@ -62,25 +62,25 @@ class TestManager(TestCase):
def test_missing_source(self):
with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \
Manager(get_config_filename('provider-problems.yaml')) \
.sync(['missing.sources.'])
self.assertTrue('missing sources' in text_type(ctx.exception))
def test_missing_targets(self):
with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \
Manager(get_config_filename('provider-problems.yaml')) \
.sync(['missing.targets.'])
self.assertTrue('missing targets' in text_type(ctx.exception))
def test_unknown_source(self):
with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \
Manager(get_config_filename('provider-problems.yaml')) \
.sync(['unknown.source.'])
self.assertTrue('unknown source' in text_type(ctx.exception))
def test_unknown_target(self):
with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \
Manager(get_config_filename('provider-problems.yaml')) \
.sync(['unknown.target.'])
self.assertTrue('unknown target' in text_type(ctx.exception))
@ -99,7 +99,7 @@ class TestManager(TestCase):
def test_source_only_as_a_target(self):
with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \
Manager(get_config_filename('provider-problems.yaml')) \
.sync(['not.targetable.'])
self.assertTrue('does not support targeting' in
text_type(ctx.exception))


Loading…
Cancel
Save