def test_unpair(self): ''' Test to unpair bluetooth adaptor with a device ''' mock = MagicMock(side_effect=[False, True]) with patch.object(salt.utils.validate.net, 'mac', mock): self.assertRaises(CommandExecutionError, bluez.unpair, "DE:AD:BE:EF:CA:FE") mock = MagicMock(return_value="Ok") with patch.dict(bluez.__salt__, {'cmd.run': mock}): self.assertListEqual(bluez.unpair("DE:AD:BE:EF:CA:FE"), ["Ok"])