Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add RHCloud.advisor_engine_config API #1276

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -7669,7 +7669,7 @@ def __init__(self, server_config=None, **kwargs):

def path(self, which=None):
"""Extend ``nailgun.entity_mixins.Entity.path``."""
if which in ("enable_connector",):
if which in ("enable_connector", "advisor_engine_config"):
return f'{super().path(which="base")}/{which}'
return super().path(which)

Expand All @@ -7683,6 +7683,13 @@ def enable_connector(self, synchronous=True, timeout=None, **kwargs):
response = client.post(self.path('enable_connector'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def advisor_engine_config(self, synchronous=True, timeout=None, **kwargs):
"""Get advisor engine configuration information."""
kwargs = kwargs.copy()
kwargs.update(self._server_config.get_client_kwargs())
response = client.get(self.path('advisor_engine_config'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)


class RoleLDAPGroups(Entity):
"""A representation of a Role LDAP Groups entity."""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def test_noid_and_which(self):
(entities.ForemanTask, 'bulk_search'),
(entities.ForemanTask, 'summary'),
(entities.RHCloud, 'enable_connector'),
(entities.RHCloud, 'advisor_engine_config'),
(entities.Template, 'imports'),
(entities.Template, 'exports'),
):
Expand Down Expand Up @@ -2225,6 +2226,7 @@ def setUpClass(cls):
'post',
{'organization_id': 1, 'location_id': 2},
),
(entities.RHCloud(**plain_taxonomy).advisor_engine_config, 'get', {}),
(entities.Snapshot(**snapshot).revert, 'put', {}),
)

Expand Down