Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

host: inherit LCE & CV with nested hostgroup #14925

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
22 changes: 13 additions & 9 deletions tests/foreman/api/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,26 +246,30 @@ def test_positive_create_inherit_lce_cv(
module_default_org_view, module_lce_library, module_org, module_target_sat
):
"""Create a host with hostgroup specified. Make sure host inherited
hostgroup's lifecycle environment and content-view
hostgroup's lifecycle environment and content-view.
Make sure this also works with a nested hostgroup.

:id: 229cbdbc-838b-456c-bc6f-4ac895badfbc

:expectedresults: Host's lifecycle environment and content view match
the ones specified in hostgroup

:BZ: 1391656
:BZ: 1391656, 2266432
"""
hostgroup = module_target_sat.api.HostGroup(
parent_hg = module_target_sat.api.HostGroup(
content_view=module_default_org_view,
lifecycle_environment=module_lce_library,
organization=[module_org],
).create()
host = module_target_sat.api.Host(hostgroup=hostgroup, organization=module_org).create()
assert (
host.content_facet_attributes['lifecycle_environment']['id']
== hostgroup.lifecycle_environment.id
)
assert host.content_facet_attributes['content_view']['id'] == hostgroup.content_view.id
nested_hg = module_target_sat.api.HostGroup(parent=parent_hg).create()

for hg in [parent_hg, nested_hg]:
host = module_target_sat.api.Host(hostgroup=hg, organization=module_org).create()
assert (
host.content_facet_attributes['lifecycle_environment']['id']
== hg.lifecycle_environment.id
)
assert host.content_facet_attributes['content_view']['id'] == hg.content_view.id


@pytest.mark.tier2
Expand Down