1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Retain octodns settings on record copy

This commit is contained in:
Viranch Mehta
2021-09-21 02:47:59 -07:00
parent c3b68ce4c6
commit 7d7a1361b2
2 changed files with 32 additions and 0 deletions

View File

@@ -222,6 +222,7 @@ class Record(EqualityTupleMixin):
def copy(self, zone=None):
data = self.data
data['type'] = self._type
data['octodns'] = self._octodns
return Record.new(
zone if zone else self.zone,

View File

@@ -1055,6 +1055,37 @@ class TestRecord(TestCase):
d.copy()
self.assertEquals('TXT', d._type)
def test_dynamic_record_copy(self):
a_data = {
'dynamic': {
'pools': {
'one': {
'values': [{
'value': '3.3.3.3',
}],
},
},
'rules': [{
'pool': 'one',
}],
},
'octodns': {
'healthcheck': {
'protocol': 'TCP',
'port': 80,
},
},
'ttl': 60,
'type': 'A',
'values': [
'1.1.1.1',
'2.2.2.2',
],
}
record1 = Record.new(self.zone, 'a', a_data)
record2 = record1.copy()
self.assertEqual(record1._octodns, record2._octodns)
def test_change(self):
existing = Record.new(self.zone, 'txt', {
'ttl': 44,