Skip to content

Conversation

sambible
Copy link
Contributor

Problem Statement

A few bootc tests should be using the dummy_bootc_host (This refers to the host being set with a "dummy" hosts facts file, so it can be verified consistently).

Solution

This changes those 2 tests to use that, and runs pre-commit cleanup on the UI file.

@sambible sambible requested a review from a team as a code owner October 16, 2025 04:37
@sambible sambible removed the request for review from a team October 16, 2025 04:38
@sambible sambible added CherryPick PR needs CherryPick to previous branches 6.17.z 6.18.z labels Oct 16, 2025
Copy link

@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 - here's some feedback:

  • Avoid shadowing the dummy_bootc_host fixture by reassigning it when you do the API search—use a new variable name to keep the original fixture intact.
  • You have several nearly identical assertions against content_facet_attributes—consider looping over the expected keys and values to reduce duplication.
  • Both tests begin by calling register and checking .subscribed on dummy_bootc_host—factoring that into a small helper or custom fixture could make the tests cleaner.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Avoid shadowing the dummy_bootc_host fixture by reassigning it when you do the API search—use a new variable name to keep the original fixture intact.
- You have several nearly identical assertions against content_facet_attributes—consider looping over the expected keys and values to reduce duplication.
- Both tests begin by calling register and checking .subscribed on dummy_bootc_host—factoring that into a small helper or custom fixture could make the tests cleaner.

## Individual Comments

### Comment 1
<location> `tests/foreman/ui/test_imagemode.py:87` </location>
<code_context>
def test_bootc_host_details(target_sat, dummy_bootc_host, function_ak_with_cv, function_org):
    """Create a bootc host, and read it's information via the Host Details UI

    :id: 842356e9-8798-421d-aca6-0a1774c3f22b

    :expectedresults: Host Details UI contains the proper information for a bootc host

    :Verifies:SAT-27171
    """
    bootc_dummy_info = json.loads(DUMMY_BOOTC_FACTS)
    assert (
        dummy_bootc_host.register(function_org, None, function_ak_with_cv.name, target_sat).status
        == 0
    )
    assert dummy_bootc_host.subscribed

    with target_sat.ui_session() as session:
        session.organization.select(function_org.name)
        values = session.host_new.get_details(
            dummy_bootc_host.hostname, widget_names='details.bootc'
        )
        assert (
            values['details']['bootc']['details']['running_image']
            == bootc_dummy_info['bootc.booted.image']
        )
        assert (
            values['details']['bootc']['details']['running_image_digest']
            == bootc_dummy_info['bootc.booted.digest']
        )
        assert (
            values['details']['bootc']['details']['rollback_image']
            == bootc_dummy_info['bootc.rollback.image']
        )
        assert (
            values['details']['bootc']['details']['rollback_image_digest']
            == bootc_dummy_info['bootc.rollback.digest']
        )

</code_context>

<issue_to_address>
**issue (code-quality):** Extract code out into function ([`extract-method`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/extract-method/))
</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.

@sambible
Copy link
Contributor Author

rigger: test-robottelo
pytest: tests/foreman/api/test_imagemode.py -k 'test_positive_bootc_api_actions'

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 13205
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_imagemode.py -k test_positive_bootc_api_actions --external-logging
Test Result : =========== 1 passed, 4 deselected, 9 warnings in 967.17s (0:16:07) ============

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.17.z 6.18.z CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants