示例#1
0
async def test_json_actor_command_write(json_actor, json_client):

    command = Command(
        command_string="ping",
        actor=json_actor,
    )

    command.set_status("RUNNING")
    command.write("i", text="Pong")

    assert len(command.replies) == 2
    assert command.replies[0].message_code == ">"
示例#2
0
文件: test_actor.py 项目: sdss/clu
async def test_write_exception(actor):

    command = Command(
        command_string="ping",
        actor=actor,
    )

    command.set_status("RUNNING")
    command.write("e", error=ValueError("Error message"))

    assert len(command.replies) == 2
    assert command.replies[1].message_code == "e"
    assert command.replies[1].message["error"] == "Error message"
示例#3
0
def _output(
    command: Command,
    controller: ArchonController,
    text: str,
    message_code="d",
):
    command.write(
        message_code=message_code,
        text=dict(
            controller=controller.name,
            text=text,
        ),
    )
示例#4
0
文件: test_amqp.py 项目: sdss/clu
async def test_write_exception(amqp_actor):

    command = Command(
        command_string="ping",
        actor=amqp_actor,
    )

    command.set_status("RUNNING")
    command.write("e", error=ValueError("Error message"))

    assert len(command.replies) == 2
    assert command.replies[1].message_code == "e"
    assert command.replies.get("error") == {
        "exception_module": "builtins",
        "exception_type": "ValueError",
        "exception_message": "Error message",
    }