Browse Source

ValueMixin._data always includes 'value'

pull/1113/head
Ross McFarland 2 years ago
parent
commit
cb09b590e7
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
2 changed files with 13 additions and 4 deletions
  1. +1
    -2
      octodns/record/base.py
  2. +12
    -2
      tests/test_octodns_record.py

+ 1
- 2
octodns/record/base.py View File

@ -374,8 +374,7 @@ class ValueMixin(object):
def _data(self):
ret = super()._data()
if self.value:
ret['value'] = getattr(self.value, 'data', self.value)
ret['value'] = getattr(self.value, 'data', self.value)
return ret
@property


+ 12
- 2
tests/test_octodns_record.py View File

@ -225,13 +225,13 @@ class TestRecord(TestCase):
a = AliasRecord(
self.zone, '', {'type': 'ALIAS', 'ttl': 600, 'value': None}
)
self.assertNotIn('value', a.data)
self.assertIsNone(a.data['value'])
# unspecified value, no value in data
a = AliasRecord(
self.zone, '', {'type': 'ALIAS', 'ttl': 600, 'value': ''}
)
self.assertNotIn('value', a.data)
self.assertIsNone(a.data['value'])
def test_record_new(self):
txt = Record.new(
@ -349,6 +349,16 @@ class TestRecord(TestCase):
dup = txt.copy()
self.assertEqual(txt.values, dup.values)
cname = Record.new(
self.zone,
'cname',
{'ttl': 45, 'type': 'CNAME', 'value': ''},
lenient=True,
)
dup = cname.copy()
self.assertEqual(cname.value, dup.value)
def test_change(self):
existing = Record.new(
self.zone, 'txt', {'ttl': 44, 'type': 'TXT', 'value': 'some text'}


Loading…
Cancel
Save