Skip to content

Commit

Permalink
fix config settings from pytest plugin not being set in Infrahub SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
wvandeun committed Sep 18, 2024
1 parent 33cd3fd commit a397132
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python_sdk/infrahub_sdk/pytest_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ def pytest_sessionstart(session: Session) -> None:
"default_branch": session.config.option.infrahub_branch,
}
if hasattr(session.config.option, "infrahub_key"):
client_config = {"api_token": session.config.option.infrahub_key}
client_config["api_token"] = session.config.option.infrahub_key
elif hasattr(session.config.option, "infrahub_username") and hasattr(session.config.option, "infrahub_password"):
client_config = {
"username": session.config.option.infrahub_username,
"password": session.config.option.infrahub_password,
}
client_config.pop("api_token")
client_config["username"] = session.config.option.infrahub_username
client_config["password"] = session.config.option.infrahub_password

infrahub_client = InfrahubClientSync(config=client_config)
session.infrahub_client = infrahub_client # type: ignore[attr-defined]
Expand Down

0 comments on commit a397132

Please sign in to comment.