[6.18.z] Add entity for content view environments endpoint#1360
Merged
Gauravtalreja1 merged 1 commit into6.18.zfrom Sep 29, 2025
Merged
Conversation
* Add entity for content view environments endpoint This PR adds an entity class for the content view environments endpoint. This is required for automating SAT-34301. * Address review feedback (cherry picked from commit 626be3e)
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `nailgun/entities.py:3269` </location>
<code_context>
+ """Get the list of content view environments, passing along any query parameters."""
+ kwargs = kwargs.copy()
+ kwargs.update(self._server_config.get_client_kwargs())
+ url = f'{self._server_config.url}/{self._meta["api_path"]}'
+ response = client.get(url, params=params, **kwargs)
+ return _handle_response(response, self._server_config, synchronous, timeout)
</code_context>
<issue_to_address>
**suggestion:** URL construction may result in double slashes if server_config.url ends with a slash.
To prevent double slashes, use urljoin or remove any trailing slash from self._server_config.url before concatenation.
Suggested implementation:
```python
from urllib.parse import urljoin
url = urljoin(self._server_config.url, self._meta["api_path"])
response = client.get(url, params=params, **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)
```
If `urljoin` is already imported elsewhere in the file, you can remove the inline import and use the existing one.
</issue_to_address>
### Comment 2
<location> `nailgun/entities.py:3268` </location>
<code_context>
def list_content_view_environments(self, params=None, synchronous=True, timeout=None, **kwargs):
"""Get the list of content view environments, passing along any query parameters."""
kwargs = kwargs.copy()
kwargs.update(self._server_config.get_client_kwargs())
url = f'{self._server_config.url}/{self._meta["api_path"]}'
response = client.get(url, params=params, **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)
</code_context>
<issue_to_address>
**suggestion (code-quality):** Merge dictionary updates via the union operator ([`dict-assign-update-to-union`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/dict-assign-update-to-union/))
```suggestion
kwargs |= self._server_config.get_client_kwargs()
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| """Get the list of content view environments, passing along any query parameters.""" | ||
| kwargs = kwargs.copy() | ||
| kwargs.update(self._server_config.get_client_kwargs()) | ||
| url = f'{self._server_config.url}/{self._meta["api_path"]}' |
There was a problem hiding this comment.
suggestion: URL construction may result in double slashes if server_config.url ends with a slash.
To prevent double slashes, use urljoin or remove any trailing slash from self._server_config.url before concatenation.
Suggested implementation:
from urllib.parse import urljoin
url = urljoin(self._server_config.url, self._meta["api_path"])
response = client.get(url, params=params, **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)If urljoin is already imported elsewhere in the file, you can remove the inline import and use the existing one.
Member
|
PRT passed in SatelliteQE/robottelo#19604 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherrypick of PR: #1357
This PR adds an entity class for the content view environments endpoint. This is required for automating SAT-34301.
Upstream API documentation, plugin, or feature links
https://apidocs.theforeman.org/katello/4.18/apidoc/v2/content_view_environments/index.html
Demonstration
PRT run in SatelliteQE/robottelo#19581.