#NEWLINE# def test_running_with_predifined_volume( self ) : #NEWLINE# #INDENT# '\n        Test dockerng.running function with an image\n        that already have VOLUME defined.\n\n        The ``binds`` argument, should create a container\n        with ``volumes`` extracted from ``binds``.\n        ' #NEWLINE# dockerng_create = Mock ( ) #NEWLINE# dockerng_start = Mock ( ) #NEWLINE# dockerng_inspect_image = Mock ( return_value = { #NEWLINE# #INDENT# 'Id' : 'abcd' , #NEWLINE# 'Config' : { #NEWLINE# #INDENT# 'Config' : { #NEWLINE# #INDENT# 'Volumes' : [ '/host-1' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# __salt__ = { #NEWLINE# #INDENT# 'dockerng.list_containers' : MagicMock ( ) , #NEWLINE# 'dockerng.list_tags' : MagicMock ( ) , #NEWLINE# 'dockerng.pull' : MagicMock ( ) , #NEWLINE# 'dockerng.state' : MagicMock ( ) , #NEWLINE# 'dockerng.inspect_image' : __salt__ , #NEWLINE# 'dockerng.create' : dockerng_create , #NEWLINE# 'dockerng.start' : dockerng_start , #NEWLINE# #UNINDENT# } #NEWLINE# with patch . dict ( dockerng_state . __dict__ , { #NEWLINE# #INDENT# '__salt__' : __salt__ , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# dockerng_state . running ( 'cont' , image = 'image:latest' , binds = [ '/host-0:/container-0:ro' ] ) #NEWLINE# #UNINDENT# dockerng_create . assert_called_with ( 'image:latest' , validate_input = False , binds = { #NEWLINE# #INDENT# '/host-0' : { #NEWLINE# #INDENT# 'bind' : '/container-0' , #NEWLINE# 'ro' : True , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , volumes = [ '/container-0' ] , validate_ip_addrs = False , name = 'cont' , client_timeout = 60 ) #NEWLINE# dockerng_start . assert_called_with ( 'cont' )