#NEWLINE# def test_net_closest_parent( client , site ) : #NEWLINE# #INDENT# 'Test that Network.closest_parent returns instance of Network or dict' #NEWLINE# site_id = site [ 'id' ] #NEWLINE# c = client #NEWLINE# parent = Network ( client = c , site_id = site_id , cidr = '8.8.8.0/24' ) #NEWLINE# assert parent . ensure ( ) #NEWLINE# child = Network ( client = c , site_id = site_id , cidr = '8.8.8.8/32' ) #NEWLINE# assert ( child . closest_parent ( ) == parent ) #NEWLINE# orphan = Network ( client = c , site_id = orphan , cidr = '1.1.1.1/32' ) #NEWLINE# assert ( not orphan . closest_parent ( ) ) #NEWLINE# assert ( orphan . closest_parent ( ) == { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } )