Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed Oct 17, 2024
1 parent 1b24825 commit bf318d7
Showing 1 changed file with 69 additions and 23 deletions.
92 changes: 69 additions & 23 deletions tests/foreman/ui/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
"""

from fauxfactory import gen_string
from time import sleep
import pytest

from airgun.exceptions import NoSuchElementException
from robottelo.config import settings
from robottelo.constants import (
FAKE_FILE_NEW_NAME,
Expand Down Expand Up @@ -168,17 +170,16 @@ def test_positive_delete_cv_promoted_to_multi_env(
:id: f16f2db5-7f5b-4ebb-863e-6c18ff745ce4
:steps:
1. Create a yum repo on satellite
2. Create a content view and add the repository
3. Publish the content view, creates "Version 1.0"
4. Promote the "Version 1.0" to multiple environments Library -> DEV
5. Delete the promoted content view version
6. Publish and promote a new "Version 1.0" to multiple environments
7. Delete the content view
:expectedresults:
5. Deleting the promoted CVV, removed the CV from multiple environments.
7. Deleting the CV with promoted CVV, removed the CV from multiple environments.
1. Create a yum repository on satellite and add to a new content view.
2. Publish the content view, creates "Version 1.0".
3. Promote the "Version 1.0" to multiple environments, Library -> DEV.
4. Delete the promoted version, verify removed from environments.
5. Publish and promote a new "Version 1.0" to multiple environments.
6. Delete the entire content view, verify removed from environments.
:expectedresults: The deleted CV and CVV do not exist,
4. Deleting the single promoted CVV, removed the CV from multiple environments.
6. Deleting the entire CV containing promoted CVV, removed the CV from multiple environments.
:CaseImportance: High
"""
Expand All @@ -198,25 +199,70 @@ def test_positive_delete_cv_promoted_to_multi_env(
f'Latest version for CV {cv["name"]}: {cv_info["Latest version"]},'
f' does not match expected: {VERSION}.'
)
cvv_values = session.contentview_new.read_cv(cv['name'], VERSION)
assert lce['name'] in cvv_values['Environments']
cvv_values = session.contentview_new.read_cv(entity_name=cv['name'], version_name=VERSION)
#assert all(['Library', lce['name']]) in cvv_values['Environments']
# read UI info from repo table in CVV
repo_info = session.contentview_new.read_version_table(cv['name'], VERSION, 'repositories')
repo_info = session.contentview_new.read_version_table(
entity_name=cv['name'],
version=VERSION,
tab_name='repositories',
)
assert (
repo_name == repo_info[0]['Name']
), 'Repositories tab for CVV shows incorrect repo name.'
), 'Repositories tab for CVV shows incorrect repository.'
# read UI info from LCE of the CVV
lce_values = session.lifecycleenvironment.read(lce['name'])
assert len(lce_values['content_views']['resources']) == 1
assert (
cv['name'] == lce_values['content_views']['resources'][0]['Name']
), f'Environment {lce["name"]}, does not show expected CVV {cv["name"]}, contained within.'
# delete the CVV, try searching for it, then delete the ContentView itself
session.contentview_new.click_version_dropdown(cv['name'], VERSION, 'Delete')
), f'Environment {lce["name"]}, does not show expected CV {cv["name"]}, contained within.'

# Delete the promoted CVV
session.contentview_new.delete_version(entity_name=cv['name'], version=VERSION)
with pytest.raises(NoSuchElementException) as err:
# CVV is no longer visible in Versions table
session.contentview_new.read_cv(entity_name=cv['name'], version_name=VERSION)
# the CV's name is not associated to LCEs anymore
lce_values = session.lifecycleenvironment.read(lce['name'])
assert cv['name'] not in str(lce_values['content_views']['resources'])
lce_values = session.lifecycleenvironment.read('Library')
assert cv['name'] not in str(lce_values['content_views']['resources'])

# publish & promote, a new Version 1.0, to test deleting entire CV with CVV in LCEs.
# UI methods aren't needed, as this case does not test publish or promote
cvv_id = target_sat.api.ContentView(id=cv['id']).publish()['input']['content_view_version_id']
waiter = target_sat.cli.ContentView.version_promote(
{
'id': cvv_id,
'organization-id': module_org.id,
'to-lifecycle-environment-id': lce['id'],
'async': False,
}
)
#at = target_sat.api.ContentViewVersion(id=cvv_id).promote(data={'environment_ids': lce.id})
#cvv_values = session.contentview_new.read_cv(entity_name=cv['name'], version_name=VERSION)
# the promotion associated CV and LCE again
assert 'Library' in str(cvv_values['Environments'])
assert lce['name'] in str(cvv_values['Environments'])
lce_values = session.lifecycleenvironment.read(lce['name'])
assert cv['name'] == lce_values['content_views']['resources'][0]['Name']

# delete the whole content view
session.contentview_new.delete(cv['name'])
#breakpoint()
cv_info = session.contentview_new.search(cv['name'])
assert len(cv_info) == 0
# session.contentview.remove_version(cv['name'], VERSION, False, [ENVIRONMENT, lce['name']])
cv = session.contentview_new.search(cv['name'], VERSION)[0]
"""assert lce['name'] not in cv['Environments']
assert 'Library' not in cv['Environments']"""
session.contentview.delete(cv['name'])
#cv = session.contentview_new.read_cv(cv['name'], VERSION)
#breakpoint()
# the deleted CV's name is not found in LCEs
#assert any('Library', lce['name']) not in cvv_values['Environments']
#assert 'Library' not in cv['Environments']
lce_values = session.lifecycleenvironment.read(lce['name'])
assert cv not in lce_values['content_views']['resources']
assert cv['name'] not in str(lce_values['content_views']['resources'])
lce_values = session.lifecycleenvironment.read('Library')
assert cv['name'] not in str(lce_values['content_views']['resources'])

# ensure the deleted CV and CVV are not present
#target_sat.api.ContentView(id=cv['id']).read()
#target_sat.api.ContentViewVersion(id=cvv_values['id]).read()

0 comments on commit bf318d7

Please sign in to comment.