Skip to content

Commit

Permalink
[CC Automation] Test for hammer host list command with cv and lce fie…
Browse files Browse the repository at this point in the history
…lds (#15484)

Test for hammer host list cv and lce

(cherry picked from commit 372dfdd)
  • Loading branch information
ColeHiggins2 authored and web-flow committed Jun 24, 2024
1 parent d30174d commit 3576a0f
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,54 @@ def test_positive_search_all_field_sets(module_target_sat):
assert field in list(output_field_sets[host_idx].keys())


@pytest.mark.rhel_ver_match('8')
@pytest.mark.cli_host_subscription
@pytest.mark.tier3
def test_positive_host_list_with_cv_and_lce(
target_sat,
rhel_contenthost,
function_ak_with_cv,
function_promoted_cv,
function_org,
function_lce,
):
"""The output from hammer host list correctly includes both Content View and
Lifecycle Environment fields. Specifying these fields explicitly in the command
also yields the correct output.
:id: 3ece2a52-0b91-453e-a4ea-c0376d79fd2d
:steps:
1. Register a Host
2. Run the hammer host list command
3. Verify information is correct and that both CV and LCE are in the output
4. Run the hammer list command with CV and LCE fields specified
5. Verify information is correct and that both CV and LCE are in the output
:expectedresults: Both cases should return CV and LCE in the output
:Verifies: SAT-23576, SAT-22677
:customerscenario: true
"""
# register client
result = rhel_contenthost.register(function_org, None, function_ak_with_cv.name, target_sat)
assert result.status == 0
assert rhel_contenthost.subscribed
# list host command without specifying cv or lce
host_list = target_sat.cli.Host.list(output_format='json')
host = next(i for i in host_list if i['name'] == rhel_contenthost.hostname)
assert host['content-view'] == function_promoted_cv.name
assert host['lifecycle-environment'] == function_lce.name
# list host command with specifying cv and lce
host_list_fields = target_sat.cli.Host.list(
options={'fields': ['Name', 'Content view', 'Lifecycle environment']}, output_format='json'
)
host = next(i for i in host_list_fields if i['name'] == rhel_contenthost.hostname)
assert host['content-view'] == function_promoted_cv.name
assert host['lifecycle-environment'] == function_lce.name


# -------------------------- CREATE SCENARIOS -------------------------
@pytest.mark.e2e
@pytest.mark.cli_host_create
Expand Down

0 comments on commit 3576a0f

Please sign in to comment.