#NEWLINE# def test_integration5_ip( self ) : #NEWLINE# #INDENT# root_domain = create_fake_zone ( 'wee5.wee.mozilla.com' , '' ) #NEWLINE# create_fake_zone ( '10.in-addr.arpa' , '' ) #NEWLINE# ( res , error ) = compile_to_django ( '10.in-addr.arpa OR wee5.wee.mozilla.com' ) #NEWLINE# self . assertFalse ( error ) #NEWLINE# self . assertEqual ( len ( res [ 'SOA' ] ) , 2 ) #NEWLINE# self . assertEqual ( len ( res [ 'NS' ] ) , 2 ) #NEWLINE# self . assertEqual ( len ( res [ 'DOMAIN' ] ) , 2 ) #NEWLINE# PTR . objects . create ( name = 'host1.wee2.wee.mozilla.com' , ip_str = '10.0.0.1' , ip_type = '4' ) #NEWLINE# AddressRecord . objects . create ( label = 'host1' , domain = root_domain , ip_str = '10.0.0.1' , ip_type = '4' ) #NEWLINE# PTR . objects . create ( name = 'host2.wee2.wee.mozilla.com' , ip_str = '10.0.0.5' , ip_type = '4' ) #NEWLINE# AddressRecord . objects . create ( label = 'host2' , domain = site2 , ip_str = '10.0.0.5' , ip_type = '4' ) #NEWLINE# vlan1 = Vlan . objects . create ( name = 'vlan-foo' , number = 1 ) #NEWLINE# vlan2 = Vlan . objects . create ( name = 'vlan-foo' , number = 2 ) #NEWLINE# site1 = Site . objects . create ( full_name = 'foo-site' ) #NEWLINE# site2 = Site . objects . create ( full_name = 'bar-site' ) #NEWLINE# Network . objects . create ( network_str = '10.0.0.0/30' , ip_type = '4' , vlan = vlan1 , site = site1 ) #NEWLINE# Network . objects . create ( network_str = '10.0.0.4/30' , ip_type = '4' , vlan = vlan2 , site = site2 ) #NEWLINE# ( res , error ) = compile_to_django ( 'ip=:10.0.0.5' ) #NEWLINE# self . assertFalse ( error ) #NEWLINE# self . assertEqual ( len ( res [ 'PTR' ] ) , 1 ) #NEWLINE# self . assertEqual ( len ( res [ 'A' ] ) , 1 ) #NEWLINE# self . assertEqual ( len ( res [ 'NET' ] ) , 1 ) #NEWLINE# self . assertEqual ( len ( res [ 'SITE' ] ) , 1 ) #NEWLINE# self . assertEqual ( len ( res [ 'VLAN' ] ) , 1 )