From 787ce7ccc86f3ad9fbe4b337b394023772f119eb Mon Sep 17 00:00:00 2001 From: Viranch Mehta Date: Mon, 27 Sep 2021 18:31:38 -0700 Subject: [PATCH] Add the default status in tests to make them pass --- octodns/provider/constellix.py | 7 ++++++- tests/test_octodns_provider_dyn.py | 3 +++ tests/test_octodns_provider_ns1.py | 10 ++++++++++ tests/test_octodns_provider_route53.py | 12 ++++++------ tests/test_octodns_record.py | 20 ++++++++++++++++++++ 5 files changed, 45 insertions(+), 7 deletions(-) diff --git a/octodns/provider/constellix.py b/octodns/provider/constellix.py index 863ad66..93f809b 100644 --- a/octodns/provider/constellix.py +++ b/octodns/provider/constellix.py @@ -618,7 +618,12 @@ class ConstellixProvider(BaseProvider): for i, rule in enumerate(record.dynamic.rules): pool_name = rule.data.get('pool') pool = record.dynamic.pools.get(pool_name) - values = pool.data.get('values') + values = [ + { + 'value': value['value'], + 'weight': value['weight'], + } for value in pool.data.get('values', []) + ] # Make a pool name based on zone, record, type and name generated_pool_name = \ diff --git a/tests/test_octodns_provider_dyn.py b/tests/test_octodns_provider_dyn.py index 7c023fd..4072947 100644 --- a/tests/test_octodns_provider_dyn.py +++ b/tests/test_octodns_provider_dyn.py @@ -1921,12 +1921,15 @@ class TestDynProviderDynamic(TestCase): 'values': [{ 'value': '1.2.3.5', 'weight': 1, + 'status': 'obey', }, { 'value': '1.2.3.6', 'weight': 1, + 'status': 'obey', }, { 'value': '1.2.3.7', 'weight': 1, + 'status': 'obey', }] }, record.dynamic.pools['pool1'].data) self.assertEquals(2, len(record.dynamic.rules)) diff --git a/tests/test_octodns_provider_ns1.py b/tests/test_octodns_provider_ns1.py index 1b58e6b..6cd6a36 100644 --- a/tests/test_octodns_provider_ns1.py +++ b/tests/test_octodns_provider_ns1.py @@ -1614,6 +1614,7 @@ class TestNs1ProviderDynamic(TestCase): 'meta': { 'priority': 1, 'note': 'from:lhr__country', + 'up': {}, }, 'region': 'lhr', }, { @@ -1622,6 +1623,7 @@ class TestNs1ProviderDynamic(TestCase): 'priority': 2, 'weight': 12, 'note': 'from:iad', + 'up': {}, }, 'region': 'lhr', }, { @@ -1637,6 +1639,7 @@ class TestNs1ProviderDynamic(TestCase): 'priority': 1, 'weight': 12, 'note': 'from:iad', + 'up': {}, }, 'region': 'iad', }, { @@ -1652,6 +1655,7 @@ class TestNs1ProviderDynamic(TestCase): 'priority': 1, 'weight': 12, 'note': f'from:{catchall_pool_name}', + 'up': {}, }, 'region': catchall_pool_name, }, { @@ -1798,6 +1802,7 @@ class TestNs1ProviderDynamic(TestCase): 'meta': { 'priority': 1, 'note': 'from:one__country pool:one fallback:two', + 'up': {}, }, 'region': 'one_country', }, { @@ -1805,6 +1810,7 @@ class TestNs1ProviderDynamic(TestCase): 'meta': { 'priority': 2, 'note': 'from:one__country pool:two fallback:three', + 'up': {}, }, 'region': 'one_country', }, { @@ -1812,6 +1818,7 @@ class TestNs1ProviderDynamic(TestCase): 'meta': { 'priority': 3, 'note': 'from:one__country pool:three fallback:', + 'up': {}, }, 'region': 'one_country', }, { @@ -1826,6 +1833,7 @@ class TestNs1ProviderDynamic(TestCase): 'meta': { 'priority': 1, 'note': 'from:four__country pool:four fallback:', + 'up': {}, }, 'region': 'four_country', }, { @@ -1916,6 +1924,7 @@ class TestNs1ProviderDynamic(TestCase): 'priority': 1, 'weight': 12, 'note': f'from:{catchall_pool_name}', + 'up': {}, }, 'region': catchall_pool_name, }, { @@ -1923,6 +1932,7 @@ class TestNs1ProviderDynamic(TestCase): 'meta': { 'priority': 2, 'note': 'from:--default--', + 'up': {}, }, 'region': catchall_pool_name, }], diff --git a/tests/test_octodns_provider_route53.py b/tests/test_octodns_provider_route53.py index 9c9ff28..2759712 100644 --- a/tests/test_octodns_provider_route53.py +++ b/tests/test_octodns_provider_route53.py @@ -2591,25 +2591,25 @@ class TestRoute53Provider(TestCase): 'ap-southeast-1': { 'fallback': 'us-east-1', 'values': [{ - 'weight': 2, 'value': '1.4.1.1' + 'weight': 2, 'value': '1.4.1.1', 'status': 'obey', }, { - 'weight': 2, 'value': '1.4.1.2' + 'weight': 2, 'value': '1.4.1.2', 'status': 'obey', }] }, 'eu-central-1': { 'fallback': 'us-east-1', 'values': [{ - 'weight': 1, 'value': '1.3.1.1' + 'weight': 1, 'value': '1.3.1.1', 'status': 'obey', }, { - 'weight': 1, 'value': '1.3.1.2' + 'weight': 1, 'value': '1.3.1.2', 'status': 'obey', }], }, 'us-east-1': { 'fallback': None, 'values': [{ - 'weight': 1, 'value': '1.5.1.1' + 'weight': 1, 'value': '1.5.1.1', 'status': 'obey', }, { - 'weight': 1, 'value': '1.5.1.2' + 'weight': 1, 'value': '1.5.1.2', 'status': 'obey', }], } }, {k: v.data for k, v in record.dynamic.pools.items()}) diff --git a/tests/test_octodns_record.py b/tests/test_octodns_record.py index 0edfbcb..60d71ff 100644 --- a/tests/test_octodns_record.py +++ b/tests/test_octodns_record.py @@ -3423,20 +3423,25 @@ class TestDynamicRecords(TestCase): self.assertEquals({ 'value': '3.3.3.3', 'weight': 1, + 'status': 'obey', }, pools['one'].data['values'][0]) self.assertEquals([{ 'value': '4.4.4.4', 'weight': 1, + 'status': 'obey', }, { 'value': '5.5.5.5', 'weight': 1, + 'status': 'obey', }], pools['two'].data['values']) self.assertEquals([{ 'weight': 10, 'value': '4.4.4.4', + 'status': 'obey', }, { 'weight': 12, 'value': '5.5.5.5', + 'status': 'obey', }], pools['three'].data['values']) rules = dynamic.rules @@ -3526,20 +3531,25 @@ class TestDynamicRecords(TestCase): self.assertEquals({ 'value': '2601:642:500:e210:62f8:1dff:feb8:9473', 'weight': 1, + 'status': 'obey', }, pools['one'].data['values'][0]) self.assertEquals([{ 'value': '2601:642:500:e210:62f8:1dff:feb8:9474', 'weight': 1, + 'status': 'obey', }, { 'value': '2601:642:500:e210:62f8:1dff:feb8:9475', 'weight': 1, + 'status': 'obey', }], pools['two'].data['values']) self.assertEquals([{ 'weight': 10, 'value': '2601:642:500:e210:62f8:1dff:feb8:9476', + 'status': 'obey', }, { 'weight': 12, 'value': '2601:642:500:e210:62f8:1dff:feb8:9477', + 'status': 'obey', }], pools['three'].data['values']) rules = dynamic.rules @@ -3596,17 +3606,21 @@ class TestDynamicRecords(TestCase): self.assertEquals({ 'value': 'one.cname.target.', 'weight': 1, + 'status': 'obey', }, pools['one'].data['values'][0]) self.assertEquals({ 'value': 'two.cname.target.', 'weight': 1, + 'status': 'obey', }, pools['two'].data['values'][0]) self.assertEquals([{ 'value': 'three-1.cname.target.', 'weight': 12, + 'status': 'obey', }, { 'value': 'three-2.cname.target.', 'weight': 32, + 'status': 'obey', }], pools['three'].data['values']) rules = dynamic.rules @@ -4587,6 +4601,7 @@ class TestDynamicRecords(TestCase): 'values': [{ 'value': '3.3.3.3', 'weight': 1, + 'status': 'obey', }] }, 'two': { @@ -4594,9 +4609,11 @@ class TestDynamicRecords(TestCase): 'values': [{ 'value': '4.4.4.4', 'weight': 1, + 'status': 'obey', }, { 'value': '5.5.5.5', 'weight': 2, + 'status': 'obey', }] }, }, @@ -4642,6 +4659,7 @@ class TestDynamicRecords(TestCase): 'values': [{ 'value': '3.3.3.3', 'weight': 1, + 'status': 'obey', }] }, 'two': { @@ -4649,9 +4667,11 @@ class TestDynamicRecords(TestCase): 'values': [{ 'value': '4.4.4.4', 'weight': 1, + 'status': 'obey', }, { 'value': '5.5.5.5', 'weight': 2, + 'status': 'obey', }] }, },