@ -62,7 +62,7 @@ class TestRecord(TestCase):
with self . assertRaises ( RecordException ) as ctx :
with self . assertRaises ( RecordException ) as ctx :
Record . register_type ( None , ' A ' )
Record . register_type ( None , ' A ' )
self . assertEqual (
self . assertEqual (
' Type " A " already registered by ' ' octodns.record.ARecord' ,
' Type " A " already registered by octodns.record.ARecord ' ,
str ( ctx . exception ) ,
str ( ctx . exception ) ,
)
)
@ -70,6 +70,8 @@ class TestRecord(TestCase):
_type = ' AA '
_type = ' AA '
_value_type = _NsValue
_value_type = _NsValue
self . assertTrue ( ' AA ' not in Record . registered_types ( ) )
Record . register_type ( AaRecord )
Record . register_type ( AaRecord )
aa = Record . new (
aa = Record . new (
self . zone ,
self . zone ,
@ -78,6 +80,8 @@ class TestRecord(TestCase):
)
)
self . assertEqual ( AaRecord , aa . __class__ )
self . assertEqual ( AaRecord , aa . __class__ )
self . assertTrue ( ' AA ' in Record . registered_types ( ) )
def test_lowering ( self ) :
def test_lowering ( self ) :
record = ARecord (
record = ARecord (
self . zone , ' MiXeDcAsE ' , { ' ttl ' : 30 , ' type ' : ' A ' , ' value ' : ' 1.2.3.4 ' }
self . zone , ' MiXeDcAsE ' , { ' ttl ' : 30 , ' type ' : ' A ' , ' value ' : ' 1.2.3.4 ' }
@ -1868,7 +1872,7 @@ class TestRecordValidation(TestCase):
self . assertTrue ( reason . startswith ( ' invalid fqdn, " xxxx ' ) )
self . assertTrue ( reason . startswith ( ' invalid fqdn, " xxxx ' ) )
self . assertTrue (
self . assertTrue (
reason . endswith (
reason . endswith (
' .unit.tests. " is too long at 254 ' ' chars, max is 253'
' .unit.tests. " is too long at 254 chars, max is 253 '
)
)
)
)
@ -1882,7 +1886,7 @@ class TestRecordValidation(TestCase):
reason = ctx . exception . reasons [ 0 ]
reason = ctx . exception . reasons [ 0 ]
self . assertTrue ( reason . startswith ( ' invalid label, " xxxx ' ) )
self . assertTrue ( reason . startswith ( ' invalid label, " xxxx ' ) )
self . assertTrue (
self . assertTrue (
reason . endswith ( ' xxx " is too long at 64 ' ' chars, max is 63' )
reason . endswith ( ' xxx " is too long at 64 chars, max is 63 ' )
)
)
with self . assertRaises ( ValidationError ) as ctx :
with self . assertRaises ( ValidationError ) as ctx :
@ -1893,7 +1897,7 @@ class TestRecordValidation(TestCase):
reason = ctx . exception . reasons [ 0 ]
reason = ctx . exception . reasons [ 0 ]
self . assertTrue ( reason . startswith ( ' invalid label, " xxxx ' ) )
self . assertTrue ( reason . startswith ( ' invalid label, " xxxx ' ) )
self . assertTrue (
self . assertTrue (
reason . endswith ( ' xxx " is too long at 64 ' ' chars, max is 63' )
reason . endswith ( ' xxx " is too long at 64 chars, max is 63 ' )
)
)
# should not raise with dots
# should not raise with dots
@ -2526,7 +2530,7 @@ class TestRecordValidation(TestCase):
{ ' type ' : ' CNAME ' , ' ttl ' : 600 , ' value ' : ' https://google.com ' } ,
{ ' type ' : ' CNAME ' , ' ttl ' : 600 , ' value ' : ' https://google.com ' } ,
)
)
self . assertEqual (
self . assertEqual (
[ ' CNAME value " https://google.com " is not a valid ' ' FQDN' ] ,
[ ' CNAME value " https://google.com " is not a valid FQDN ' ] ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -2542,7 +2546,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
[ ' CNAME value " https://google.com/a/b/c " is not a ' ' valid FQDN' ] ,
[ ' CNAME value " https://google.com/a/b/c " is not a valid FQDN ' ] ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -2554,7 +2558,7 @@ class TestRecordValidation(TestCase):
{ ' type ' : ' CNAME ' , ' ttl ' : 600 , ' value ' : ' google.com/some/path ' } ,
{ ' type ' : ' CNAME ' , ' ttl ' : 600 , ' value ' : ' google.com/some/path ' } ,
)
)
self . assertEqual (
self . assertEqual (
[ ' CNAME value " google.com/some/path " is not a valid ' ' FQDN' ] ,
[ ' CNAME value " google.com/some/path " is not a valid FQDN ' ] ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3025,7 +3029,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
[ ' Invalid MX exchange " 100 foo.bar.com. " is not a ' ' valid FQDN.' ] ,
[ ' Invalid MX exchange " 100 foo.bar.com. " is not a valid FQDN. ' ] ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3136,7 +3140,7 @@ class TestRecordValidation(TestCase):
{ ' type ' : ' NS ' , ' ttl ' : 600 , ' value ' : ' 100 foo.bar.com. ' } ,
{ ' type ' : ' NS ' , ' ttl ' : 600 , ' value ' : ' 100 foo.bar.com. ' } ,
)
)
self . assertEqual (
self . assertEqual (
[ ' Invalid NS value " 100 foo.bar.com. " is not a ' ' valid FQDN.' ] ,
[ ' Invalid NS value " 100 foo.bar.com. " is not a valid FQDN. ' ] ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3337,7 +3341,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
[ ' unescaped ; in " this has some; ' ' semi-colons\\ ; in it " ' ] ,
[ ' unescaped ; in " this has some; semi-colons \\ ; in it " ' ] ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3541,7 +3545,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
[ ' Invalid SRV target " 100 foo.bar.com. " is not a ' ' valid FQDN.' ] ,
[ ' Invalid SRV target " 100 foo.bar.com. " is not a valid FQDN. ' ] ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3643,7 +3647,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
' invalid certificate_usage ' ' " {value[ " certificate_usage " ]} " ' ,
' invalid certificate_usage " {value[ " certificate_usage " ]} " ' ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3664,7 +3668,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
' invalid certificate_usage ' ' " {value[ " certificate_usage " ]} " ' ,
' invalid certificate_usage " {value[ " certificate_usage " ]} " ' ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3702,8 +3706,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
' invalid selector ' ' " {value[ " selector " ]} " ' ,
ctx . exception . reasons ,
' invalid selector " {value[ " selector " ]} " ' , ctx . exception . reasons
)
)
# Invalid selector
# Invalid selector
@ -3723,8 +3726,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
' invalid selector ' ' " {value[ " selector " ]} " ' ,
ctx . exception . reasons ,
' invalid selector " {value[ " selector " ]} " ' , ctx . exception . reasons
)
)
# missing matching_type
# missing matching_type
@ -3761,7 +3763,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
' invalid matching_type ' ' " {value[ " matching_type " ]} " ' ,
' invalid matching_type " {value[ " matching_type " ]} " ' ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3782,7 +3784,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
' invalid matching_type ' ' " {value[ " matching_type " ]} " ' ,
' invalid matching_type " {value[ " matching_type " ]} " ' ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)
@ -3819,7 +3821,7 @@ class TestRecordValidation(TestCase):
} ,
} ,
)
)
self . assertEqual (
self . assertEqual (
[ ' unescaped ; in " this has some; semi-colons \\ ; ' ' in it" ' ] ,
[ ' unescaped ; in " this has some; semi-colons \\ ; in it " ' ] ,
ctx . exception . reasons ,
ctx . exception . reasons ,
)
)