diff --git a/octodns/record/base.py b/octodns/record/base.py index 5d5d0af..443e7ba 100644 --- a/octodns/record/base.py +++ b/octodns/record/base.py @@ -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 diff --git a/tests/test_octodns_record.py b/tests/test_octodns_record.py index 4d52b71..86f92e5 100644 --- a/tests/test_octodns_record.py +++ b/tests/test_octodns_record.py @@ -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'}