#NEWLINE# def test_running_discard_wrong_environemnt_values( self ) : #NEWLINE# #INDENT# '\n        environment values should be string.\n        It is easy to write wrong sls this way\n\n        .. code-block:: yaml\n\n            container:\n                dockerng.running:\n                    - environment:\n                        - KEY: 1\n\n        instead of:\n\n        .. code-block:: yaml\n\n            container:\n                dockerng.running:\n                    - environment:\n                        - KEY: "1"\n        ' #NEWLINE# __salt__ = { #NEWLINE# #INDENT# 'dockerng.list_containers' : MagicMock ( ) , #NEWLINE# 'dockerng.list_tags' : MagicMock ( return_value = [ 'image:latest' ] ) , #NEWLINE# 'dockerng.inspect_image' : MagicMock ( ) , #NEWLINE# 'dockerng.pull' : MagicMock ( ) , #NEWLINE# 'dockerng.state' : MagicMock ( ) , #NEWLINE# 'dockerng.create' : MagicMock ( ) , #NEWLINE# 'dockerng.start' : MagicMock ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# with patch . dict ( dockerng_state . __dict__ , { #NEWLINE# #INDENT# '__salt__' : __salt__ , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# for wrong_value in ( 1 , 0.2 , ( ) , [ ] , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# ret = dockerng_state . running ( 'cont' , image = 'image:latest' , environment = [ { #NEWLINE# #INDENT# 'KEY' : wrong_value , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# self . assertEqual ( ret , { #NEWLINE# #INDENT# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'comment' : "Environment values must be strings KEY='{0}'" . format ( wrong_value ) , #NEWLINE# 'name' : 'cont' , #NEWLINE# 'result' : False , #NEWLINE# #UNINDENT# } )