#NEWLINE# @ requires_network ( ) #NEWLINE# @ destructiveTest #NEWLINE# def test_install_remove( self ) : #NEWLINE# #INDENT# '\n        successfully install and uninstall a package\n        ' #NEWLINE# pkg = 'htop' #NEWLINE# version = self . run_function ( 'pkg.version' , [ pkg ] ) #NEWLINE# os_grain = self . run_function ( 'grains.item' , [ 'os' ] ) [ 'os' ] #NEWLINE# os_release = self . run_function ( 'grains.item' , [ 'osrelease' ] ) [ 'osrelease' ] #NEWLINE# if ( os_grain == 'Ubuntu' ) : #NEWLINE# #INDENT# if os_release . startswith ( '12.' ) : #NEWLINE# #INDENT# self . skipTest ( 'pkg.install and pkg.remove do not work on ubuntu 12 when run from the test suite' ) #NEWLINE# #UNINDENT# #UNINDENT# def test_install( ) : #NEWLINE# #INDENT# install_ret = self . run_function ( 'pkg.install' , [ pkg ] ) #NEWLINE# self . assertIn ( pkg , install_ret ) #NEWLINE# #UNINDENT# def test_remove( ) : #NEWLINE# #INDENT# remove_ret = self . run_function ( 'pkg.remove' , [ pkg ] ) #NEWLINE# self . assertIn ( pkg , remove_ret ) #NEWLINE# #UNINDENT# if version : #NEWLINE# #INDENT# test_remove ( ) #NEWLINE# test_install ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# test_install ( ) #NEWLINE# test_remove ( )