Normalize MX exchange to lower-case, fix #322

This commit is contained in:
Peter Dave Hello
2019-04-04 22:45:34 +08:00
parent c9573d7ace
commit e0a8a619d6
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -852,7 +852,7 @@ class MxValue(object):
exchange = value['exchange']
except KeyError:
exchange = value['value']
self.exchange = exchange
self.exchange = exchange.lower()
@property
def data(self):
+11
View File
@@ -354,6 +354,17 @@ class TestRecord(TestCase):
self.assertEquals(b_value['exchange'], b.values[0].exchange)
self.assertEquals(b_data, b.data)
a_upper_values = [{
'preference': 10,
'exchange': 'SMTP1.'
}, {
'priority': 20,
'value': 'SMTP2.'
}]
a_upper_data = {'ttl': 30, 'values': a_upper_values}
a_upper = MxRecord(self.zone, 'a', a_upper_data)
self.assertEquals(a_upper.data, a.data)
target = SimpleProvider()
# No changes with self
self.assertFalse(a.changes(a, target))