#NEWLINE# def test_power( self ) : #NEWLINE# #INDENT# '\n            Test of getting address of bluetooth adapter\n        ' #NEWLINE# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . object ( bluez , 'address_' , mock ) : #NEWLINE# #INDENT# self . assertRaises ( CommandExecutionError , bluez . power , 'hci0' , 'on' ) #NEWLINE# #UNINDENT# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'hci0' : { #NEWLINE# #INDENT# 'device' : 'hci0' , #NEWLINE# 'power' : 'on' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . object ( bluez , 'address_' , mock ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = '' ) #NEWLINE# with patch . dict ( bluez . __salt__ , { #NEWLINE# #INDENT# 'cmd.run' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# self . assertTrue ( bluez . power ( 'hci0' , 'on' ) ) #NEWLINE# #UNINDENT# #UNINDENT# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'hci0' : { #NEWLINE# #INDENT# 'device' : 'hci0' , #NEWLINE# 'power' : 'on' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . object ( bluez , 'address_' , self ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = '' ) #NEWLINE# with patch . dict ( bluez . __salt__ , { #NEWLINE# #INDENT# 'cmd.run' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# self . assertFalse ( bluez . power ( 'hci0' , 'off' ) )