Skip to content

Commit

Permalink
feat: global configuration of 'legacy_upload' for insights-client
Browse files Browse the repository at this point in the history
Add a plugin configuration key to allow users to set a default value
for the 'legacy_upload' configuration key of insights-client. If not
set, whatever is in the insights-client configuration is not changed.

Signed-off-by: Pino Toscano <[email protected]>
  • Loading branch information
ptoscano committed Feb 9, 2024
1 parent ca31c81 commit 74e6a72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pytest_client_tools/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,14 @@ def save_insights_client_files(request):


@pytest.fixture
def insights_client(save_insights_client_files):
def insights_client(save_insights_client_files, test_config):
insights_client = InsightsClient()
save_config = False
with contextlib.suppress(KeyError):
insights_client.config.legacy_upload = test_config.get("insights.legacy_upload")
save_config = True
if save_config:
insights_client.config.save()
try:
yield insights_client
finally:
Expand Down
1 change: 1 addition & 0 deletions pytest_client_tools/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self):
must_exist=True,
when=Validator("candlepin.username", must_exist=True),
),
Validator("insights.legacy_upload", cast=bool, is_type_of=bool),
)
self._settings.validators.validate()

Expand Down

0 comments on commit 74e6a72

Please sign in to comment.