예제 #1
0
    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"])
예제 #2
0
파일: bluez_test.py 프로젝트: DaveQB/salt
    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"])