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

set default value for nsone cname to None, use first value if non-zero length

This commit is contained in:
Adam Smith
2017-10-26 23:55:48 -07:00
parent 1a0055eedb
commit 00aaa3bf4d
2 changed files with 36 additions and 1 deletions

View File

@@ -326,3 +326,34 @@ class TestNs1Provider(TestCase):
})
self.assertEquals(['foo; bar baz; blip'],
provider._params_for_TXT(record)['answers'])
def test_data_for_CNAME(self):
provider = Ns1Provider('test', 'api-key')
# answers from nsone
a_record = {
'ttl': 31,
'type': 'CNAME',
'short_answers': ['foo.unit.tests.']
}
a_expected = {
'ttl': 31,
'type': 'CNAME',
'value': 'foo.unit.tests.'
}
self.assertEqual(a_expected,
provider._data_for_CNAME(a_record['type'], a_record))
# no answers from nsone
b_record = {
'ttl': 32,
'type': 'CNAME',
'short_answers': []
}
b_expected = {
'ttl': 32,
'type': 'CNAME',
'value': None
}
self.assertEqual(b_expected,
provider._data_for_CNAME(b_record['type'], b_record))