Skip to content

Commit 8c82e6f

Browse files
committed
adds testsing
1 parent 6e8b829 commit 8c82e6f

File tree

1 file changed

+21
-2
lines changed
  • services/web/server/tests/unit/with_dbs/01

1 file changed

+21
-2
lines changed

services/web/server/tests/unit/with_dbs/01/test_db.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@
77

88
import yaml
99
from aiohttp.test_utils import TestServer
10+
from simcore_service_webserver.application_settings import (
11+
ApplicationSettings,
12+
get_application_settings,
13+
)
1014
from simcore_service_webserver.db.plugin import (
15+
get_async_engine,
1116
is_service_enabled,
1217
is_service_responsive,
1318
)
19+
from sqlalchemy.ext.asyncio import AsyncEngine
1420

1521

1622
def test_uses_same_postgres_version(
1723
docker_compose_file: Path, osparc_simcore_root_dir: Path
1824
):
19-
with open(docker_compose_file) as fh:
25+
with Path.open(docker_compose_file) as fh:
2026
fixture = yaml.safe_load(fh)
2127

22-
with open(osparc_simcore_root_dir / "services" / "docker-compose.yml") as fh:
28+
with Path.open(osparc_simcore_root_dir / "services" / "docker-compose.yml") as fh:
2329
expected = yaml.safe_load(fh)
2430

2531
assert (
@@ -32,3 +38,16 @@ async def test_responsive(web_server: TestServer):
3238
app = web_server.app
3339
assert is_service_enabled(app)
3440
assert await is_service_responsive(app)
41+
42+
43+
def test_async_engine(web_server: TestServer):
44+
app = web_server.app
45+
assert app
46+
settings: ApplicationSettings = get_application_settings(app)
47+
48+
# same as host
49+
assert settings.WEBSERVER_DB
50+
assert settings.WEBSERVER_DB.POSTGRES_CLIENT_NAME
51+
52+
engine: AsyncEngine = get_async_engine(app)
53+
assert engine

0 commit comments

Comments
 (0)