#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . neutron : ( 'network_get' , 'subnet_list' , 'port_list' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_network_detail_port_exception( self ) : #NEWLINE# #INDENT# network_id = self . networks . first ( ) . id #NEWLINE# api . neutron . network_get ( IsA ( http . HttpRequest ) , network_id ) . AndReturn ( self . networks . first ( ) ) #NEWLINE# api . neutron . subnet_list ( IsA ( http . HttpRequest ) , network_id = network_id ) . AndReturn ( [ self . subnets . first ( ) ] ) #NEWLINE# api . neutron . port_list ( IsA ( http . HttpRequest ) , network_id = network_id ) . AndRaise ( self . exceptions . neutron ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# res = self . client . get ( reverse ( 'horizon:admin:networks:detail' , args = [ network_id ] ) ) #NEWLINE# self . assertTemplateUsed ( res , 'project/networks/detail.html' ) #NEWLINE# subnets = res . context [ 'subnets_table' ] . data #NEWLINE# ports = res . context [ 'ports_table' ] . data #NEWLINE# self . assertItemsEqual ( subnets , [ self . subnets . first ( ) ] ) #NEWLINE# self . assertEqual ( len ( ports ) , 0 )