|
|
@ -2694,6 +2694,19 @@ class TestRecordValidation(TestCase): |
|
|
self.assertEqual(['MX value "foo.bar.com" missing trailing .'], |
|
|
self.assertEqual(['MX value "foo.bar.com" missing trailing .'], |
|
|
ctx.exception.reasons) |
|
|
ctx.exception.reasons) |
|
|
|
|
|
|
|
|
|
|
|
# exchange must be a valid FQDN |
|
|
|
|
|
with self.assertRaises(ValidationError) as ctx: |
|
|
|
|
|
Record.new(self.zone, '', { |
|
|
|
|
|
'type': 'MX', |
|
|
|
|
|
'ttl': 600, |
|
|
|
|
|
'value': { |
|
|
|
|
|
'preference': 10, |
|
|
|
|
|
'exchange': '100 foo.bar.com.' |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
self.assertEqual(['Invalid MX exchange "100 foo.bar.com." is not a ' |
|
|
|
|
|
'valid FQDN.'], ctx.exception.reasons) |
|
|
|
|
|
|
|
|
def test_NXPTR(self): |
|
|
def test_NXPTR(self): |
|
|
# doesn't blow up |
|
|
# doesn't blow up |
|
|
Record.new(self.zone, '', { |
|
|
Record.new(self.zone, '', { |
|
|
@ -2792,6 +2805,16 @@ class TestRecordValidation(TestCase): |
|
|
self.assertEqual(['NS value "foo.bar" missing trailing .'], |
|
|
self.assertEqual(['NS value "foo.bar" missing trailing .'], |
|
|
ctx.exception.reasons) |
|
|
ctx.exception.reasons) |
|
|
|
|
|
|
|
|
|
|
|
# exchange must be a valid FQDN |
|
|
|
|
|
with self.assertRaises(ValidationError) as ctx: |
|
|
|
|
|
Record.new(self.zone, '', { |
|
|
|
|
|
'type': 'NS', |
|
|
|
|
|
'ttl': 600, |
|
|
|
|
|
'value': '100 foo.bar.com.' |
|
|
|
|
|
}) |
|
|
|
|
|
self.assertEqual(['Invalid NS value "100 foo.bar.com." is not a ' |
|
|
|
|
|
'valid FQDN.'], ctx.exception.reasons) |
|
|
|
|
|
|
|
|
def test_PTR(self): |
|
|
def test_PTR(self): |
|
|
# doesn't blow up (name & zone here don't make any sense, but not |
|
|
# doesn't blow up (name & zone here don't make any sense, but not |
|
|
# important) |
|
|
# important) |
|
|
@ -3109,6 +3132,21 @@ class TestRecordValidation(TestCase): |
|
|
self.assertEqual(['SRV value "foo.bar.baz" missing trailing .'], |
|
|
self.assertEqual(['SRV value "foo.bar.baz" missing trailing .'], |
|
|
ctx.exception.reasons) |
|
|
ctx.exception.reasons) |
|
|
|
|
|
|
|
|
|
|
|
# target must be a valid FQDN |
|
|
|
|
|
with self.assertRaises(ValidationError) as ctx: |
|
|
|
|
|
Record.new(self.zone, '_srv._tcp', { |
|
|
|
|
|
'type': 'SRV', |
|
|
|
|
|
'ttl': 600, |
|
|
|
|
|
'value': { |
|
|
|
|
|
'priority': 1, |
|
|
|
|
|
'weight': 2, |
|
|
|
|
|
'port': 3, |
|
|
|
|
|
'target': '100 foo.bar.com.' |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
self.assertEqual(['Invalid SRV target "100 foo.bar.com." is not a ' |
|
|
|
|
|
'valid FQDN.'], ctx.exception.reasons) |
|
|
|
|
|
|
|
|
def test_TXT(self): |
|
|
def test_TXT(self): |
|
|
# doesn't blow up (name & zone here don't make any sense, but not |
|
|
# doesn't blow up (name & zone here don't make any sense, but not |
|
|
# important) |
|
|
# important) |
|
|
|