(site, user)
| 320 | |
| 321 | @pytest.fixture() |
| 322 | def ui_websocket(site, user): |
| 323 | class WsMock: |
| 324 | def __init__(self): |
| 325 | self.result = gevent.event.AsyncResult() |
| 326 | |
| 327 | def send(self, data): |
| 328 | self.result.set(json.loads(data)["result"]) |
| 329 | |
| 330 | def getResult(self): |
| 331 | back = self.result.get() |
| 332 | self.result = gevent.event.AsyncResult() |
| 333 | return back |
| 334 | |
| 335 | ws_mock = WsMock() |
| 336 | ui_websocket = UiWebsocket(ws_mock, site, None, user, None) |
| 337 | |
| 338 | def testAction(action, *args, **kwargs): |
| 339 | ui_websocket.handleRequest({"id": 0, "cmd": action, "params": list(args) if args else kwargs}) |
| 340 | return ui_websocket.ws.getResult() |
| 341 | |
| 342 | ui_websocket.testAction = testAction |
| 343 | return ui_websocket |
| 344 | |
| 345 | |
| 346 | @pytest.fixture(scope="session") |
nothing calls this directly
no test coverage detected