Skip to content

Commit fec4dd3

Browse files
author
Pedro Crespo
committed
Fixes login ests
1 parent 26845b1 commit fec4dd3

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

services/web/server/src/simcore_service_webserver/login/__init__.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
from servicelib.application_keys import APP_CONFIG_KEY, APP_DB_POOL_KEY
1313

1414
from ..db import DSN
15-
from ..email_config import CONFIG_SECTION_NAME as CONFIG_STMP_SECTION
15+
from ..email_config import CONFIG_SECTION_NAME as SMTP_SECTION
1616
from ..rest_config import APP_OPENAPI_SPECS_KEY
17+
from ..db_config import CONFIG_SECTION_NAME as DB_SECTION
1718
from .cfg import APP_LOGIN_CONFIG, cfg
1819
from .routes import create_routes
1920
from .storage import AsyncpgStorage
@@ -22,7 +23,7 @@
2223

2324

2425
async def pg_pool(app: web.Application):
25-
smtp_config = app[APP_CONFIG_KEY][CONFIG_STMP_SECTION]
26+
smtp_config = app[APP_CONFIG_KEY][SMTP_SECTION]
2627
config = {"SMTP_{}".format(k.upper()): v for k, v in smtp_config.items()}
2728
#'SMTP_SENDER': None,
2829
#'SMTP_HOST': REQUIRED,
@@ -34,7 +35,7 @@ async def pg_pool(app: web.Application):
3435
config = (config or {}).copy()
3536
config['APP'] = app
3637

37-
db_config = app[APP_CONFIG_KEY]['postgres']
38+
db_config = app[APP_CONFIG_KEY][DB_SECTION]['postgres']
3839
app[APP_DB_POOL_KEY] = await asyncpg.create_pool(dsn=DSN.format(**db_config), loop=app.loop)
3940

4041
# FIXME: replace by CFG_LOGIN_STORAGE
@@ -48,7 +49,7 @@ def setup(app: web.Application):
4849
log.debug("Setting up %s ...", __name__)
4950

5051
# TODO: requires rest ready!
51-
assert CONFIG_STMP_SECTION in app[APP_CONFIG_KEY]
52+
assert SMTP_SECTION in app[APP_CONFIG_KEY]
5253

5354
# routes
5455
specs = app[APP_OPENAPI_SPECS_KEY]

services/web/server/tests/login/config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ smtp:
4040
password: None
4141
rest:
4242
version: v0
43-
location: api/specs/webserver/v0/openapi.yaml
43+
location: ../../../../api/specs/webserver/v0/openapi.yaml

services/web/server/tests/login/conftest.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def docker_compose_file(here, app_cfg):
4040
"""
4141
old = os.environ.copy()
4242

43-
cfg = app_cfg["postgres"]
43+
cfg = app_cfg["db"]["postgres"]
4444

4545
# docker-compose reads these environs
4646
os.environ['TEST_POSTGRES_DB']=cfg['database']
@@ -56,7 +56,7 @@ def docker_compose_file(here, app_cfg):
5656

5757
@pytest.fixture(scope='session')
5858
def postgres_service(docker_services, docker_ip, app_cfg):
59-
cfg = app_cfg["postgres"]
59+
cfg = app_cfg["db"]["postgres"]
6060
cfg['host'] = docker_ip
6161
cfg['port'] = docker_services.port_for('postgres', 5432)
6262

@@ -79,7 +79,7 @@ def postgres_db(app_cfg, postgres_service): # NOTE: if postgres_services started
7979
8080
In that case, comment postgres_service)
8181
"""
82-
cfg = app_cfg["postgres"]
82+
cfg = app_cfg["db"]["postgres"]
8383
url = DSN.format(**cfg)
8484

8585
# NOTE: Comment this to avoid postgres_service

services/web/server/tests/login/test_logout.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from simcore_service_webserver.login import get_storage
1+
from simcore_service_webserver.login.cfg import get_storage
22

33
from utils_login import LoggedUser
44
from utils_assert import assert_status

services/web/server/tests/login/test_registration.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88

99
from servicelib.rest_responses import unwrap_envelope
1010
from simcore_service_webserver.db_models import ConfirmationAction, UserStatus
11-
from simcore_service_webserver.login import get_storage
12-
from simcore_service_webserver.login.cfg import cfg # TODO: remove this by get_storage
13-
from utils_login import NewUser, parse_link
11+
from simcore_service_webserver.login.cfg import cfg, get_storage
1412
from utils_assert import assert_error, assert_status
13+
from utils_login import NewUser, parse_link
1514

1615
EMAIL, PASSWORD = '[email protected]', 'password'
1716

services/web/server/tests/login/utils_login.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
from yarl import URL
33

44
from simcore_service_webserver.db_models import UserRole, UserStatus
5-
from simcore_service_webserver.login import get_storage
6-
from simcore_service_webserver.login.cfg import cfg
5+
from simcore_service_webserver.login.cfg import cfg, get_storage
76
from simcore_service_webserver.login.utils import (encrypt_password,
87
get_random_string)
98
from utils_assert import assert_status

0 commit comments

Comments
 (0)