ITISFoundation / osparc-simcore-clients

python client for osparc-simcore public API
https://itisfoundation.github.io/osparc-simcore-clients/
MIT License
0 stars 5 forks source link

Configuration defaults captures `OSPARC_*` #149

Open pcrespov opened 7 months ago

pcrespov commented 7 months ago

User Story

The Configuration object should by default capture specific environment variables. such that by open a jupyter-math service in osparc (see https://github.com/ITISFoundation/jupyter-math/pull/29, https://github.com/ITISFoundation/osparc-simcore/pull/5695)

from osparc import ApiClient, UsersApi, Confirmation
import os

cfg = Configuration()
print(cfg.host)

with ApiClient(cfg) as api_client:
    users_api = UsersApi(api_client)
    profile = users_api.get_my_profile()
    print(profile)

Definition of Done

from osparc import ApiClient, UsersApi, Confirmation
import os

@pytest.fixture
def mock_osparc_service_envs(monkeypatch):
    # emulate osparc variable and secrets mechanism here where starting a service
    ...

def test_done(mock_osparc_service_envs):
  assert Configuration() = Configuration(
      host=os.environ["OSPARC_API_HOST"],
      username=os.environ["OSPARC_API_KEY"],
      password=os.environ["OSPARC_API_SECRET"],
  )