def test_iot_digitaltwin_invoke_command(self, fixture_cmd, serviceclient,
                                            command_payload):

        payload = None
        interface = 'environmentalSensor'
        command = 'blink'

        # If file path provided
        if not command_payload[0]:
            payload = command_payload[1]
        else:
            payload = str(
                read_file_content(_device_digitaltwin_invoke_command_payload))

        subject.iot_digitaltwin_invoke_command(fixture_cmd,
                                               device_id=device_id,
                                               interface=interface,
                                               command_name=command,
                                               command_payload=payload,
                                               login=mock_target['cs'])
        args = serviceclient.call_args
        url = args[0][0].url
        method = args[0][0].method

        assert method == 'POST'
        assert '{}/digitalTwins/{}/interfaces/{}/commands/{}?'.format(
            mock_target['entity'], device_id, interface, command) in url
 def test_iot_digitaltwin_property_update_error(self, fixture_cmd,
                                                serviceclient_error,
                                                command_payload, interface,
                                                command):
     payload = None
     if not command_payload[0]:
         payload = command_payload[1]
     else:
         payload = str(
             read_file_content(_device_digitaltwin_invoke_command_payload))
     with pytest.raises(CLIError):
         subject.iot_digitaltwin_invoke_command(fixture_cmd,
                                                device_id=device_id,
                                                interface=interface,
                                                command_name=command,
                                                command_payload=payload,
                                                login=mock_target['cs'])