Skip to content

[6.18.z] Add entity for content view environments endpoint#1360

Merged
Gauravtalreja1 merged 1 commit into6.18.zfrom
cherry-pick-6.18.z-626be3ea2e3527e14fbff6cc429a520d476dfb42
Sep 29, 2025
Merged

[6.18.z] Add entity for content view environments endpoint#1360
Gauravtalreja1 merged 1 commit into6.18.zfrom
cherry-pick-6.18.z-626be3ea2e3527e14fbff6cc429a520d476dfb42

Conversation

@Satellite-QE
Copy link
Copy Markdown
Contributor

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.

* 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)
@Satellite-QE Satellite-QE added 6.18.z Auto_Cherry_Picked GHA has automatically cherrypicked this PR No-CherryPick PR doesnt need CherryPick to previous branches labels Sep 22, 2025
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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"]}'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Gauravtalreja1
Copy link
Copy Markdown
Member

PRT passed in SatelliteQE/robottelo#19604

@Gauravtalreja1 Gauravtalreja1 merged commit 9c57f24 into 6.18.z Sep 29, 2025
20 checks passed
@Gauravtalreja1 Gauravtalreja1 deleted the cherry-pick-6.18.z-626be3ea2e3527e14fbff6cc429a520d476dfb42 branch September 29, 2025 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.18.z Auto_Cherry_Picked GHA has automatically cherrypicked this PR No-CherryPick PR doesnt need CherryPick to previous branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants