@ -1799,6 +1799,16 @@ class TestRecordValidation(TestCase):
} )
} )
self . assertEquals ( [ ' empty value ' ] , ctx . exception . reasons )
self . assertEquals ( [ ' empty value ' ] , ctx . exception . reasons )
# not a valid FQDN
with self . assertRaises ( ValidationError ) as ctx :
Record . new ( self . zone , ' ' , {
' type ' : ' ALIAS ' ,
' ttl ' : 600 ,
' value ' : ' __. ' ,
} )
self . assertEquals ( [ ' ALIAS value " __. " is not a valid FQDN ' ] ,
ctx . exception . reasons )
# missing trailing .
# missing trailing .
with self . assertRaises ( ValidationError ) as ctx :
with self . assertRaises ( ValidationError ) as ctx :
Record . new ( self . zone , ' ' , {
Record . new ( self . zone , ' ' , {
@ -1895,6 +1905,16 @@ class TestRecordValidation(TestCase):
} )
} )
self . assertEquals ( [ ' root CNAME not allowed ' ] , ctx . exception . reasons )
self . assertEquals ( [ ' root CNAME not allowed ' ] , ctx . exception . reasons )
# not a valid FQDN
with self . assertRaises ( ValidationError ) as ctx :
Record . new ( self . zone , ' www ' , {
' type ' : ' CNAME ' ,
' ttl ' : 600 ,
' value ' : ' ___. ' ,
} )
self . assertEquals ( [ ' CNAME value " ___. " is not a valid FQDN ' ] ,
ctx . exception . reasons )
# missing trailing .
# missing trailing .
with self . assertRaises ( ValidationError ) as ctx :
with self . assertRaises ( ValidationError ) as ctx :
Record . new ( self . zone , ' www ' , {
Record . new ( self . zone , ' www ' , {
@ -1920,6 +1940,16 @@ class TestRecordValidation(TestCase):
' value ' : ' foo.bar.com. ' ,
' value ' : ' foo.bar.com. ' ,
} )
} )
# not a valid FQDN
with self . assertRaises ( ValidationError ) as ctx :
Record . new ( self . zone , ' www ' , {
' type ' : ' DNAME ' ,
' ttl ' : 600 ,
' value ' : ' . ' ,
} )
self . assertEquals ( [ ' DNAME value " . " is not a valid FQDN ' ] ,
ctx . exception . reasons )
# missing trailing .
# missing trailing .
with self . assertRaises ( ValidationError ) as ctx :
with self . assertRaises ( ValidationError ) as ctx :
Record . new ( self . zone , ' www ' , {
Record . new ( self . zone , ' www ' , {
@ -2103,6 +2133,16 @@ class TestRecordValidation(TestCase):
} )
} )
self . assertEquals ( [ ' missing value ' ] , ctx . exception . reasons )
self . assertEquals ( [ ' missing value ' ] , ctx . exception . reasons )
# not a valid FQDN
with self . assertRaises ( ValidationError ) as ctx :
Record . new ( self . zone , ' ' , {
' type ' : ' PTR ' ,
' ttl ' : 600 ,
' value ' : ' _. ' ,
} )
self . assertEquals ( [ ' PTR value " _. " is not a valid FQDN ' ] ,
ctx . exception . reasons )
# no trailing .
# no trailing .
with self . assertRaises ( ValidationError ) as ctx :
with self . assertRaises ( ValidationError ) as ctx :
Record . new ( self . zone , ' ' , {
Record . new ( self . zone , ' ' , {