Skip to content

Commit 026ffb5

Browse files
committed
cleanup
1 parent 8378ef5 commit 026ffb5

File tree

3 files changed

+40
-51
lines changed

3 files changed

+40
-51
lines changed

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

Lines changed: 38 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,50 @@
1-
# pylint:disable=unused-variable
2-
# pylint:disable=unused-argument
3-
# pylint:disable=redefined-outer-name
1+
# pylint: disable=redefined-outer-name
2+
# pylint: disable=unused-argument
3+
# pylint: disable=unused-variable
4+
# pylint: disable=too-many-arguments
45

56
import re
6-
from copy import deepcopy
77

88
import pytest
99
from aiohttp import web_exceptions
1010
from aioresponses.core import aioresponses
11-
from simcore_service_webserver.application_settings_utils import AppConfigDict
11+
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
12+
from pytest_simcore.helpers.typing_env import EnvVarsDict
1213

1314

1415
@pytest.fixture
15-
def app_cfg(default_app_cfg: AppConfigDict, unused_tcp_port_factory):
16-
"""App's configuration used for every test in this module
17-
18-
NOTE: Overrides services/web/server/tests/unit/with_dbs/conftest.py::app_cfg to influence app setup
19-
"""
20-
cfg = deepcopy(default_app_cfg)
21-
22-
cfg["main"]["port"] = unused_tcp_port_factory()
23-
cfg["main"]["studies_access_enabled"] = True
24-
25-
exclude = {
26-
"tracing",
27-
"smtp",
28-
"storage",
29-
"activity",
30-
"diagnostics",
31-
"tags",
32-
"publications",
33-
"catalog",
34-
"computation",
35-
"products",
36-
"socketio",
37-
"resource_manager",
38-
"projects",
39-
"login",
40-
"users",
41-
}
42-
include = {
43-
"db",
44-
"rest",
45-
"groups",
46-
}
47-
48-
assert include.intersection(exclude) == set()
49-
50-
for section in include:
51-
cfg[section]["enabled"] = True
52-
for section in exclude:
53-
cfg[section]["enabled"] = False
54-
55-
# NOTE: To see logs, use pytest -s --log-cli-level=DEBUG
56-
## setup_logging(level=logging.DEBUG)
57-
58-
return cfg
16+
def app_environment(
17+
monkeypatch: pytest.MonkeyPatch,
18+
app_environment: EnvVarsDict,
19+
) -> EnvVarsDict:
20+
21+
monkeypatch.delenv("WEBSERVER_STUDIES_DISPATCHER", raising=False)
22+
app_environment.pop("WEBSERVER_STUDIES_DISPATCHER", None)
23+
24+
return app_environment | setenvs_from_dict(
25+
monkeypatch,
26+
{
27+
# exclude
28+
"WEBSERVER_ACTIVITY": "null",
29+
"WEBSERVER_CATALOG": "null",
30+
"WEBSERVER_CLUSTERS": "null",
31+
"WEBSERVER_COMPUTATION": "null",
32+
"WEBSERVER_DIAGNOSTICS": "null",
33+
"WEBSERVER_EMAIL": "null",
34+
"WEBSERVER_GARBAGE_COLLECTOR": "null",
35+
"WEBSERVER_GROUPS": "0",
36+
"WEBSERVER_LOGIN": "null",
37+
"WEBSERVER_PRODUCTS": "0",
38+
"WEBSERVER_PROJECTS": "null",
39+
"WEBSERVER_PUBLICATIONS": "0",
40+
"WEBSERVER_SOCKETIO": "0",
41+
"WEBSERVER_STORAGE": "null",
42+
"WEBSERVER_RESOURCE_MANAGER": "null",
43+
"WEBSERVER_TAGS": "0",
44+
"WEBSERVER_TRACING": "null",
45+
"WEBSERVER_USERS": "null",
46+
},
47+
)
5948

6049

6150
@pytest.mark.skip(reason="UNDER DEV: test_group_handlers")

services/web/server/tests/unit/with_dbs/03/meta_modeling/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def app_environment(
2929
"WEBSERVER_GROUPS": "0",
3030
"WEBSERVER_PUBLICATIONS": "0",
3131
"WEBSERVER_GARBAGE_COLLECTOR": "null",
32-
"WEBSERVER_SMTP": "null",
32+
"WEBSERVER_EMAIL": "null",
3333
"WEBSERVER_SOCKETIO": "0",
3434
"WEBSERVER_STORAGE": "null",
3535
"WEBSERVER_STUDIES_DISPATCHER": "null",

services/web/server/tests/unit/with_dbs/03/version_control/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def app_environment(
8484
"WEBSERVER_GROUPS": "0",
8585
"WEBSERVER_PUBLICATIONS": "0",
8686
"WEBSERVER_GARBAGE_COLLECTOR": "null",
87-
"WEBSERVER_SMTP": "null",
87+
"WEBSERVER_EMAIL": "null",
8888
"WEBSERVER_SOCKETIO": "0",
8989
"WEBSERVER_STORAGE": "null",
9090
"WEBSERVER_STUDIES_DISPATCHER": "null",

0 commit comments

Comments
 (0)