Ejemplo n.º 1
0
async def test_call_remote_method(base_server: Server, klippy: KlippyProcess):
    fut = base_server.get_event_loop().create_future()

    def method_test(result):
        fut.set_result(result)

    base_server.register_remote_method("moonraker_test", method_test)
    base_server.load_components()
    await base_server.server_init()
    ret = base_server.klippy_connection.wait_connected()
    await asyncio.wait_for(ret, 4.)
    klippy.send_gcode("TEST_REMOTE_METHOD")
    await fut
    await base_server._stop_server("terminate")
    assert fut.result() == "test"
Ejemplo n.º 2
0
async def test_register_remote_method_running(full_server: Server):
    await full_server.start_server(connect_to_klippy=False)
    with pytest.raises(ServerError):
        full_server.register_remote_method("moonraker_test", lambda: None)
Ejemplo n.º 3
0
 def test_register_method_exists(self, core_server: Server):
     with pytest.raises(ServerError):
         core_server.register_remote_method("shutdown_machine",
                                            lambda: None)
Ejemplo n.º 4
0
 def test_register_remote_method(self, core_server: Server):
     core_server.register_remote_method("moonraker_test", lambda: None)
     kconn = core_server.klippy_connection
     assert "moonraker_test" in kconn.remote_methods