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 == ">"
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"
def _output( command: Command, controller: ArchonController, text: str, message_code="d", ): command.write( message_code=message_code, text=dict( controller=controller.name, text=text, ), )
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", }