#NEWLINE# def test_install_capability( self ) : #NEWLINE# #INDENT# '\n            Test installing a capability with DISM\n        ' #NEWLINE# expected = { #NEWLINE# #INDENT# 'comment' : 'Capa2 was installed.\n' , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# 'installed' : 'Capa2' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'name' : 'Capa2' , #NEWLINE# 'result' : True , #NEWLINE# #UNINDENT# } #NEWLINE# installed_mock = MagicMock ( return_value = [ 'Capa1' ] ) #NEWLINE# install_mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'retcode' : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . dict ( dism . __salt__ , { #NEWLINE# #INDENT# 'dism.installed_capabilities' : installed_mock , #NEWLINE# 'dism.install_capability' : install_mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# out = dism . capability_installed ( 'Capa2' , 'somewhere' , True ) #NEWLINE# installed_mock . assert_called_once_with ( ) #NEWLINE# install_mock . assert_called_once_with ( 'Capa2' , 'somewhere' , True ) #NEWLINE# self . assertEqual ( out , expected )