async def test_no_uds(base_server: Server):
    attempts = [1, 2, 3]

    def mock_is_running():
        attempts.pop(0)
        return len(attempts) > 0

    base_server.is_running = mock_is_running
    ret = await base_server.klippy_connection._do_connect()
    assert ret is False
async def test_no_uds_access(base_server: Server,
                             path_args: Dict[str, pathlib.Path]):
    attempts = [1, 2, 3]
    uds_path = path_args['klippy_uds_path']
    uds_path.write_text("test")
    uds_path.chmod(mode=222)

    def mock_is_running():
        attempts.pop(0)
        return len(attempts) > 0

    base_server.is_running = mock_is_running
    ret = await base_server.klippy_connection._do_connect()
    assert ret is False
示例#3
0
 def test_running(self, base_server: Server):
     assert base_server.is_running() is False
示例#4
0
 def test_running(self, server: Server):
     assert server.is_running() is True
示例#5
0
 def test_running(self, full_server: Server):
     assert full_server.is_running() is False
示例#6
0
 def test_running(self, core_server: Server):
     assert core_server.is_running() is False