mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-22 05:11:05 -05:00
tests: Make the indexstore test async.
This commit is contained in:
parent
42e363fafc
commit
1311dbdef0
@ -94,21 +94,19 @@ class TestClass(object):
|
|||||||
assert task not in tasks
|
assert task not in tasks
|
||||||
assert task2 in tasks
|
assert task2 in tasks
|
||||||
|
|
||||||
def test_new_indexstore(self, tempdir):
|
async def test_new_indexstore(self, tempdir):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
store = IndexStore("example", tempdir)
|
store = IndexStore("example", tempdir)
|
||||||
|
|
||||||
store.add_event(self.test_event, TEST_ROOM, None, None)
|
store.add_event(self.test_event, TEST_ROOM, None, None)
|
||||||
store.add_event(self.another_event, TEST_ROOM, None, None)
|
store.add_event(self.another_event, TEST_ROOM, None, None)
|
||||||
loop.run_until_complete(store.commit_events())
|
await store.commit_events()
|
||||||
|
|
||||||
assert store.event_in_store(self.test_event.event_id, TEST_ROOM)
|
assert store.event_in_store(self.test_event.event_id, TEST_ROOM)
|
||||||
assert not store.event_in_store("FAKE", TEST_ROOM)
|
assert not store.event_in_store("FAKE", TEST_ROOM)
|
||||||
|
|
||||||
result = loop.run_until_complete(
|
result = await store.search("test", TEST_ROOM, after_limit=10, before_limit=10)
|
||||||
store.search("test", TEST_ROOM, after_limit=10, before_limit=10)
|
|
||||||
)
|
|
||||||
pprint.pprint(result)
|
pprint.pprint(result)
|
||||||
|
|
||||||
assert len(result["results"]) == 1
|
assert len(result["results"]) == 1
|
||||||
|
Loading…
Reference in New Issue
Block a user