refactor(websocket): use robot_name alias instead of duplicate wrapper method
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -10,6 +10,8 @@ from robot.api import logger
|
|||||||
class WebSocketKeywords:
|
class WebSocketKeywords:
|
||||||
"""Keywords for WebSocket testing."""
|
"""Keywords for WebSocket testing."""
|
||||||
|
|
||||||
|
ROBOT_AUTO_KEYWORDS = True
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._connection: Optional[websockets.WebSocketClientProtocol] = None
|
self._connection: Optional[websockets.WebSocketClientProtocol] = None
|
||||||
|
|
||||||
@@ -25,9 +27,7 @@ class WebSocketKeywords:
|
|||||||
asyncio.run(self._async_connect(ws_url))
|
asyncio.run(self._async_connect(ws_url))
|
||||||
return f"Connected to {ws_url}"
|
return f"Connected to {ws_url}"
|
||||||
|
|
||||||
def Connect_To_WebSocket(self, ws_url: str) -> str:
|
connect_to_websocket.robot_name = "Connect To WebSocket"
|
||||||
"""Robot Framework alias for connect_to_websocket."""
|
|
||||||
return self.connect_to_websocket(ws_url)
|
|
||||||
|
|
||||||
async def _async_connect(self, ws_url: str) -> None:
|
async def _async_connect(self, ws_url: str) -> None:
|
||||||
self._connection = await websockets.connect(ws_url)
|
self._connection = await websockets.connect(ws_url)
|
||||||
|
|||||||
Reference in New Issue
Block a user