add unit tests for new Python API

This commit is contained in:
Sarah Hoffmann
2022-12-07 19:47:46 +01:00
parent cf19036ce6
commit 9d31a67116
7 changed files with 230 additions and 6 deletions

View File

@@ -38,6 +38,14 @@ class NominatimAPIAsync:
future=True)
async def close(self) -> None:
""" Close all active connections to the database. The NominatimAPIAsync
object remains usable after closing. If a new API functions is
called, new connections are created.
"""
await self.engine.dispose()
async def status(self) -> StatusResult:
""" Return the status of the database.
"""
@@ -53,6 +61,14 @@ class NominatimAPI:
self.async_api = NominatimAPIAsync(project_dir, environ)
def close(self) -> None:
""" Close all active connections to the database. The NominatimAPIAsync
object remains usable after closing. If a new API functions is
called, new connections are created.
"""
asyncio.get_event_loop().run_until_complete(self.async_api.close())
def status(self) -> StatusResult:
""" Return the status of the database.
"""