#NEWLINE# def test_network_absent( self ) : #NEWLINE# #INDENT# '\n        Test dockerng.network_absent\n        ' #NEWLINE# dockerng_remove_network = Mock ( return_value = 'removed' ) #NEWLINE# dockerng_disconnect_container_from_network = Mock ( return_value = 'disconnected' ) #NEWLINE# __salt__ = { #NEWLINE# #INDENT# 'dockerng.remove_network' : __salt__ , #NEWLINE# 'dockerng.disconnect_container_from_network' : dockerng_disconnect_container_from_network , #NEWLINE# 'dockerng.networks' : Mock ( return_value = [ { #NEWLINE# #INDENT# 'Containers' : { #NEWLINE# #INDENT# 'container' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] ) , #NEWLINE# #UNINDENT# } #NEWLINE# with patch . dict ( dockerng_state . __dict__ , { #NEWLINE# #INDENT# '__salt__' : __salt__ , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# ret = dockerng_state . network_absent ( 'network_foo' ) #NEWLINE# #UNINDENT# dockerng_disconnect_container_from_network . assert_called_with ( 'container' , 'network_foo' ) #NEWLINE# dockerng_remove_network . assert_called_with ( 'network_foo' ) #NEWLINE# self . assertEqual ( ret , { #NEWLINE# #INDENT# 'name' : 'network_foo' , #NEWLINE# 'comment' : '' , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# 'disconnected' : 'disconnected' , #NEWLINE# 'removed' : 'removed' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'result' : True , #NEWLINE# #UNINDENT# } )