#NEWLINE# def test_running_with_labels_from_image( self ) : #NEWLINE# #INDENT# '\n        Test dockerng.running with labels parameter supports also\n        labels carried by the image.\n        ' #NEWLINE# dockerng_create = Mock ( ) #NEWLINE# image_id = ( 'a' * 128 ) #NEWLINE# dockerng_inspect_image = MagicMock ( return_value = { #NEWLINE# #INDENT# 'Id' : image_id , #NEWLINE# 'Config' : { #NEWLINE# #INDENT# 'Hostname' : 'saltstack-container' , #NEWLINE# 'WorkingDir' : '/' , #NEWLINE# 'Cmd' : [ 'bash' ] , #NEWLINE# 'Volumes' : { #NEWLINE# #INDENT# '/path' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# 'Entrypoint' : None , #NEWLINE# 'ExposedPorts' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'Labels' : { #NEWLINE# #INDENT# 'IMAGE_LABEL' : 'image_foo' , #NEWLINE# 'LABEL1' : 'label1' , #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' : dockerng_inspect_image , #NEWLINE# 'dockerng.create' : dockerng_create , #NEWLINE# #UNINDENT# } #NEWLINE# with patch . dict ( dockerng_state . __dict__ , { #NEWLINE# #INDENT# '__salt__' : __salt__ , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# dockerng_state . running ( 'cont' , image = 'image:latest' , labels = [ { #NEWLINE# #INDENT# 'LABEL1' : 'foo1' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'LABEL2' : 'foo2' , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# #UNINDENT# dockerng_create . assert_called_with ( 'image:latest' , validate_input = False , validate_ip_addrs = False , name = 'cont' , labels = { #NEWLINE# #INDENT# 'LABEL1' : 'foo1' , #NEWLINE# 'LABEL2' : 'foo2' , #NEWLINE# #UNINDENT# } , client_timeout = 60 )