Add basic EQ handling to client

This commit is contained in:
Salad Dais
2023-12-12 21:17:47 +00:00
parent f1b523b5de
commit 007c79f4a7
2 changed files with 64 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ from typing import Tuple, Optional
import aioresponses
from hippolyzer.lib.base import llsd
from hippolyzer.lib.base.datatypes import UUID
from hippolyzer.lib.base.message.circuit import Circuit
from hippolyzer.lib.base.message.message import Message, Block
@@ -83,6 +84,13 @@ class TestHippoClient(unittest.IsolatedAsyncioTestCase):
"region_y": 123,
"seed_capability": "https://127.0.0.1:4/foo",
}
FAKE_SEED_RESP = {
"EventQueueGet": "https://127.0.0.1:5/",
}
FAKE_EQ_RESP = {
"id": 1,
"events": [],
}
def setUp(self):
self.server_handler = MessageHandler()
@@ -99,7 +107,8 @@ class TestHippoClient(unittest.IsolatedAsyncioTestCase):
async def _do_login():
with aioresponses.aioresponses() as m:
m.post(self.FAKE_LOGIN_URI, body=self._make_fake_login_body())
m.post(self.FAKE_LOGIN_RESP['seed_capability'], body="<llsd><map></map></llsd>")
m.post(self.FAKE_LOGIN_RESP['seed_capability'], body=llsd.format_xml(self.FAKE_SEED_RESP))
m.post(self.FAKE_SEED_RESP['EventQueueGet'], body=llsd.format_xml(self.FAKE_EQ_RESP))
await client.login("foo", "bar", login_uri=self.FAKE_LOGIN_URI)
await client.logout()