#NEWLINE# def _test_initialize_gateway( self , existing , expected , routes = '' ) : #NEWLINE# #INDENT# self . flags ( fake_network = False ) #NEWLINE# executes = [ ] #NEWLINE# def fake_execute( * args , **kwargs ) : #NEWLINE# #INDENT# executes . append ( args ) #NEWLINE# if ( ( args [ 0 ] == 'ip' ) and ( args [ 1 ] == 'addr' ) and ( args [ 2 ] == 'show' ) ) : #NEWLINE# #INDENT# return ( existing , '' ) #NEWLINE# #UNINDENT# if ( ( args [ 0 ] == 'ip' ) and ( args [ 1 ] == 'route' ) and ( args [ 2 ] == 'show' ) ) : #NEWLINE# #INDENT# return ( routes , '' ) #NEWLINE# #UNINDENT# if ( args [ 0 ] == 'sysctl' ) : #NEWLINE# #INDENT# return ( '1\n' , '' ) #NEWLINE# #UNINDENT# #UNINDENT# self . stubs . Set ( utils , 'execute' , fake_execute ) #NEWLINE# network = { #NEWLINE# #INDENT# 'dhcp_server' : '192.168.1.1' , #NEWLINE# 'cidr' : '192.168.1.0/24' , #NEWLINE# 'broadcast' : '192.168.1.255' , #NEWLINE# 'cidr_v6' : '2001:db8::/64' , #NEWLINE# #UNINDENT# } #NEWLINE# self . driver . initialize_gateway_device ( 'eth0' , network ) #NEWLINE# self . assertEqual ( routes , executes )