Browse Source

Add the default status in tests to make them pass

pull/780/head
Viranch Mehta 4 years ago
parent
commit
787ce7ccc8
No known key found for this signature in database GPG Key ID: D83D1392AE9F93B4
5 changed files with 45 additions and 7 deletions
  1. +6
    -1
      octodns/provider/constellix.py
  2. +3
    -0
      tests/test_octodns_provider_dyn.py
  3. +10
    -0
      tests/test_octodns_provider_ns1.py
  4. +6
    -6
      tests/test_octodns_provider_route53.py
  5. +20
    -0
      tests/test_octodns_record.py

+ 6
- 1
octodns/provider/constellix.py View File

@ -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 = \


+ 3
- 0
tests/test_octodns_provider_dyn.py View File

@ -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))


+ 10
- 0
tests/test_octodns_provider_ns1.py View File

@ -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,
}],


+ 6
- 6
tests/test_octodns_provider_route53.py View File

@ -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()})


+ 20
- 0
tests/test_octodns_record.py View File

@ -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',
}]
},
},


Loading…
Cancel
Save