Skip to content

Commit

Permalink
Fixes login tests. Added new variable in config
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Crespo committed Nov 13, 2018
1 parent f85a452 commit bd48b1e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion services/web/server/tests/login/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ smtp:
password: None
rest:
version: v0
location: ../../../../api/specs/webserver/v0/openapi.yaml
location: ${OSPARC_SIMCORE_REPO_ROOTDIR}/api/specs/webserver/v0/openapi.yaml
17 changes: 15 additions & 2 deletions services/web/server/tests/login/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,26 @@
def here():
return Path(sys.argv[0] if __name__ == "__main__" else __file__).resolve().parent


@pytest.fixture(scope='session')
def osparc_simcore_root_dir(here):
root_dir = here.parent.parent.parent.parent.parent.resolve()
assert root_dir.exists(), "Is this service within osparc-simcore repo?"
assert any(root_dir.glob("services/web/server")), "%s not look like rootdir" % root_dir
return root_dir

@pytest.fixture(scope="session")
def app_cfg(here):
def app_cfg(here, osparc_simcore_root_dir):
cfg_path = here / "config.yaml"
assert cfg_path.exists()

variables = dict(os.environ)
variables.update({
'OSPARC_SIMCORE_REPO_ROOTDIR': str(osparc_simcore_root_dir),
})

# validates and fills all defaults/optional entries that normal load would not do
cfg_dict = trafaret_config.read_and_validate(cfg_path, CONFIG_SCHEMA)
cfg_dict = trafaret_config.read_and_validate(cfg_path, CONFIG_SCHEMA, vars=variables)
return cfg_dict

@pytest.fixture(scope='session')
Expand Down

0 comments on commit bd48b1e

Please sign in to comment.