Skip to content

Commit

Permalink
vkvk
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin on chickenita committed Sep 26, 2023
1 parent 872356f commit ba92a86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pypeman/plugins/tests/test_remoteadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ async def test_search_messages_with_rtext_flt(self, webremoteclient):
assert json_resp['messages'][0]['id'] == self.msg3.uuid

async def test_replay_message(self, webremoteclient):
assert await self.chan.message_store.total() == 4
resp = await webremoteclient.get(f"/channels/{self.chan_name}/messages/{self.msg3.uuid}/replay")
assert resp.status == 200

json_resp = json.loads(await resp.text())
assert len(json_resp) == 1
assert await self.chan.message_store.total() == 5

# Clean
await self.chan.message_store.delete(json_resp[0]["uuid"])
await self.chan.message_store.delete(json_resp["uuid"])

async def test_push_message(self, webremoteclient):
pass # actually not implemented
Expand Down
4 changes: 3 additions & 1 deletion pypeman/remoteadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,16 @@ def send_command(self, command, args=None):
"""
if args is None:
args = []
if not isinstance(args, list):
args = [args]
return self.loop.run_until_complete(self._send_command(command, args))

async def _send_command(self, command, args):
"""
Asynchronous version of command sending
"""
async with websockets.connect(self.url) as ws:
await ws.send(request_json(command, [*args]))
await ws.send(request_json(command, *args))
response = await ws.recv()
parsed_response = parse_json(response)
return parsed_response.result
Expand Down

0 comments on commit ba92a86

Please sign in to comment.