コード例 #1
0
    def test_execute_command_with_arg_translate_failed(self):
        config = UtilsTester.config['driver']
        driver = BaseDriver(config, None)
        driver.sendCommandRaw = MagicMock()

        driver.executeCommand('command2', 'arg')
        driver.sendCommandRaw.assert_called_with(
            'command2', config['commands']['command2'], 'arg')
コード例 #2
0
    def test_execute_command_translate_numberic(self):
        config = UtilsTester.config['driver']
        driver = BaseDriver(config, None, True)
        driver.sendCommandRaw = MagicMock()

        driver.executeCommand('command2', '0')
        driver.sendCommandRaw.assert_called_with(
            'command2', config['commands']['command2'], 'value1')
コード例 #3
0
    def test_execute_command(self):
        config = UtilsTester.config['driver']
        driver = BaseDriver(config, None)
        driver.sendCommandRaw = MagicMock()

        driver.executeCommand('command1')
        driver.sendCommandRaw.assert_called_with(
            'command1', config['commands']['command1'], None)
コード例 #4
0
    def test_execute_command_float_param_no_fract(self):
        config = UtilsTester.config['numberParams']
        driver = BaseDriver(config, None)
        driver.sendCommandRaw = MagicMock(return_value='0')

        driver.executeCommand('floatCommand', '1')
        driver.sendCommandRaw.assert_called_with(
            'floatCommand', config['commands']['floatCommand'], '1')
コード例 #5
0
    def test_execute_command_int_param(self):
        config = UtilsTester.config['numberParams']
        driver = BaseDriver(config, None)
        driver.sendCommandRaw = MagicMock()

        driver.executeCommand('intCommand', '123')
        driver.sendCommandRaw.assert_called_with(
            'intCommand', config['commands']['intCommand'], '123')
コード例 #6
0
    def test_execute_command_bool_param_translate(self):
        config = UtilsTester.config['numberParams']
        driver = BaseDriver(config, None)
        driver.sendCommandRaw = MagicMock()

        driver.executeCommand('boolCommandTranslate', '1')
        driver.sendCommandRaw.assert_called_with(
            'boolCommandTranslate', config['commands']['boolCommandTranslate'],
            True)
コード例 #7
0
ファイル: test_driver.py プロジェクト: firstone/RESTRemote
    def test_execute_command_list(self):
        config = UtilsTester.config['driver']
        driver = BaseDriver(config, None)
        driver.sendCommandRaw = MagicMock()

        driver.executeCommand('command7')
        sub_command = copy.deepcopy(
            config['commands']['command7']['commands'][0])
        sub_command['has_more'] = True
        driver.sendCommandRaw.assert_has_calls([
            call('command7', sub_command, None),
            call('command7', config['commands']['command7']['commands'][1],
                 None)
        ])