mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
populating existing provider state is lenient
- adds lenient flag to Record.new, problems during validation are just warnings if it's true - target populate calls during the plan phase pass lenient=True - make all of the provider.populate call logging consistent including both target and lenient - add source=self to Record.new in a few places that were missing it
This commit is contained in:
@@ -643,6 +643,7 @@ class TestRecordValidation(TestCase):
|
||||
'value': '1.2.3.4',
|
||||
})
|
||||
self.assertEquals(['missing ttl'], ctx.exception.reasons)
|
||||
|
||||
# invalid ttl
|
||||
with self.assertRaises(ValidationError) as ctx:
|
||||
Record.new(self.zone, 'www', {
|
||||
@@ -653,6 +654,21 @@ class TestRecordValidation(TestCase):
|
||||
self.assertEquals('www.unit.tests.', ctx.exception.fqdn)
|
||||
self.assertEquals(['invalid ttl'], ctx.exception.reasons)
|
||||
|
||||
# no exception if we're in lenient mode
|
||||
Record.new(self.zone, 'www', {
|
||||
'type': 'A',
|
||||
'ttl': -1,
|
||||
'value': '1.2.3.4',
|
||||
}, lenient=True)
|
||||
|
||||
# __init__ may still blow up, even if validation is lenient
|
||||
with self.assertRaises(KeyError) as ctx:
|
||||
Record.new(self.zone, 'www', {
|
||||
'type': 'A',
|
||||
'ttl': -1,
|
||||
}, lenient=True)
|
||||
self.assertEquals(('value',), ctx.exception.args)
|
||||
|
||||
def test_A_and_values_mixin(self):
|
||||
# doesn't blow up
|
||||
Record.new(self.zone, '', {
|
||||
|
Reference in New Issue
Block a user