mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge branch 'main' into dynamic-zones
This commit is contained in:
@@ -104,13 +104,15 @@ class TestManager(TestCase):
|
||||
with self.assertRaises(ManagerException) as ctx:
|
||||
name = 'bad-plan-output-missing-class.yaml'
|
||||
Manager(get_config_filename(name)).sync()
|
||||
self.assertEqual('plan_output bad is missing class', str(ctx.exception))
|
||||
self.assertTrue(
|
||||
'plan_output bad is missing class' in str(ctx.exception)
|
||||
)
|
||||
|
||||
def test_bad_plan_output_config(self):
|
||||
with self.assertRaises(ManagerException) as ctx:
|
||||
Manager(get_config_filename('bad-plan-output-config.yaml')).sync()
|
||||
self.assertEqual(
|
||||
'Incorrect plan_output config for bad', str(ctx.exception)
|
||||
self.assertTrue(
|
||||
'Incorrect plan_output config for bad' in str(ctx.exception)
|
||||
)
|
||||
|
||||
def test_source_only_as_a_target(self):
|
||||
|
||||
@@ -22,6 +22,7 @@ from octodns.record import (
|
||||
ValidationError,
|
||||
ValuesMixin,
|
||||
)
|
||||
from octodns.yaml import ContextDict
|
||||
from octodns.zone import Zone
|
||||
|
||||
|
||||
@@ -572,3 +573,58 @@ class TestRecordValidation(TestCase):
|
||||
},
|
||||
lenient=True,
|
||||
)
|
||||
|
||||
def test_validation_context(self):
|
||||
# fails validation, no context
|
||||
with self.assertRaises(ValidationError) as ctx:
|
||||
Record.new(
|
||||
self.zone, 'www', {'type': 'A', 'ttl': -1, 'value': '1.2.3.4'}
|
||||
)
|
||||
self.assertFalse(', line' in str(ctx.exception))
|
||||
|
||||
# fails validation, with context
|
||||
with self.assertRaises(ValidationError) as ctx:
|
||||
Record.new(
|
||||
self.zone,
|
||||
'www',
|
||||
ContextDict(
|
||||
{'type': 'A', 'ttl': -1, 'value': '1.2.3.4'},
|
||||
context='needle',
|
||||
),
|
||||
)
|
||||
self.assertTrue('needle' in str(ctx.exception))
|
||||
|
||||
def test_invalid_type_context(self):
|
||||
# fails validation, no context
|
||||
with self.assertRaises(Exception) as ctx:
|
||||
Record.new(
|
||||
self.zone, 'www', {'type': 'X', 'ttl': 42, 'value': '1.2.3.4'}
|
||||
)
|
||||
self.assertFalse(', line' in str(ctx.exception))
|
||||
|
||||
# fails validation, with context
|
||||
with self.assertRaises(Exception) as ctx:
|
||||
Record.new(
|
||||
self.zone,
|
||||
'www',
|
||||
ContextDict(
|
||||
{'type': 'X', 'ttl': 42, 'value': '1.2.3.4'},
|
||||
context='needle',
|
||||
),
|
||||
)
|
||||
self.assertTrue('needle' in str(ctx.exception))
|
||||
|
||||
def test_missing_type_context(self):
|
||||
# fails validation, no context
|
||||
with self.assertRaises(Exception) as ctx:
|
||||
Record.new(self.zone, 'www', {'ttl': 42, 'value': '1.2.3.4'})
|
||||
self.assertFalse(', line' in str(ctx.exception))
|
||||
|
||||
# fails validation, with context
|
||||
with self.assertRaises(Exception) as ctx:
|
||||
Record.new(
|
||||
self.zone,
|
||||
'www',
|
||||
ContextDict({'ttl': 42, 'value': '1.2.3.4'}, context='needle'),
|
||||
)
|
||||
self.assertTrue('needle' in str(ctx.exception))
|
||||
|
||||
Reference in New Issue
Block a user