Skip to content

Commit

Permalink
bookmark entities reduced parametrization (#14542)
Browse files Browse the repository at this point in the history
(cherry picked from commit 22cbda2)
  • Loading branch information
pondrejk authored and web-flow committed Apr 8, 2024
1 parent 9d419d0 commit 3aec412
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 118 deletions.
121 changes: 12 additions & 109 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,136 +1656,39 @@ class Colored(Box):
'Viewer',
]

BOOKMARK_ENTITIES = [
BOOKMARK_ENTITIES_SELECTION = [
{
'name': 'ActivationKey',
'controller': 'katello_activation_keys',
'session_name': 'activationkey',
'old_ui': True,
},
{'name': 'Dashboard', 'controller': 'dashboard', 'session_name': 'dashboard'},
{'name': 'Audit', 'controller': 'audits', 'session_name': 'audit'},
{
'name': 'Report',
'controller': 'config_reports',
'setup': entities.Report,
'session_name': 'configreport',
},
{'name': 'Task', 'controller': 'foreman_tasks_tasks', 'session_name': 'task'},
# TODO Load manifest for the test_positive_end_to_end from the ui/test_bookmarks.py
# {'name': 'Subscriptions', 'controller': 'subscriptions','session_name': 'subscription' },
{
'name': 'Product',
'controller': 'katello_products',
'session_name': 'product',
'old_ui': True,
},
{'name': 'Repository', 'controller': 'katello_repositories', 'session_name': 'repository'},
{
'name': 'ContentCredential',
'controller': 'katello_content_credentials',
'session_name': 'contentcredential',
'old_ui': True,
},
{
'name': 'SyncPlan',
'controller': 'katello_sync_plans',
'session_name': 'syncplan',
'old_ui': True,
},
{'name': 'ContentView', 'controller': 'katello_content_views', 'session_name': 'contentview'},
{'name': 'Errata', 'controller': 'katello_errata', 'session_name': 'errata', 'old_ui': True},
{'name': 'Package', 'controller': 'katello_erratum_packages', 'session_name': 'package'},
{
'name': 'ContainerImageTag',
'controller': 'katello_docker_tags',
'session_name': 'containerimagetag',
'old_ui': True,
},
{'name': 'Host', 'controller': 'hosts', 'setup': entities.Host, 'session_name': 'host_new'},
{'name': 'ContentHost', 'controller': 'hosts', 'session_name': 'contenthost', 'old_ui': True},
{
'name': 'HostCollection',
'controller': 'katello_host_collections',
'session_name': 'hostcollection',
'old_ui': True,
},
{'name': 'Architecture', 'controller': 'architectures', 'session_name': 'architecture'},
{
'name': 'HardwareModel',
'controller': 'models',
'setup': entities.Model,
'session_name': 'hardwaremodel',
},
{
'name': 'InstallationMedia',
'controller': 'media',
'session_name': 'media',
'setup': entities.Media,
},
{
'name': 'OperatingSystem',
'controller': 'operatingsystems',
'session_name': 'operatingsystem',
'name': 'UserGroup',
'controller': 'usergroups',
'setup': entities.UserGroup,
'session_name': 'usergroup',
},
{
'name': 'PartitionTable',
'controller': 'ptables',
'setup': entities.PartitionTable,
'session_name': 'partitiontable',
},
{
'name': 'Product',
'controller': 'katello_products',
'session_name': 'product',
'old_ui': True,
},
{
'name': 'ProvisioningTemplate',
'controller': 'provisioning_templates',
'session_name': 'provisioningtemplate',
},
{
'name': 'HostGroup',
'controller': 'hostgroups',
'setup': entities.HostGroup,
'session_name': 'hostgroup',
},
{
'name': 'DiscoveryRule',
'controller': 'discovery_rules',
'setup': entities.DiscoveryRule,
'session_name': 'discoveryrule',
},
{
'name': 'GlobalParameter',
'controller': 'common_parameters',
'setup': entities.CommonParameter,
'skip_for_ui': True,
},
{'name': 'Role', 'controller': 'ansible_roles', 'setup': entities.Role, 'session_name': 'role'},
{'name': 'Variables', 'controller': 'ansible_variables', 'session_name': 'ansiblevariables'},
{'name': 'Capsules', 'controller': 'smart_proxies', 'session_name': 'capsule'},
{
'name': 'ComputeResource',
'controller': 'compute_resources',
'setup': entities.LibvirtComputeResource,
'session_name': 'computeresource',
},
{
'name': 'ComputeProfile',
'controller': 'compute_profiles',
'setup': entities.ComputeProfile,
'session_name': 'computeprofile',
},
{'name': 'Subnet', 'controller': 'subnets', 'setup': entities.Subnet, 'session_name': 'subnet'},
{'name': 'Domain', 'controller': 'domains', 'setup': entities.Domain, 'session_name': 'domain'},
{'name': 'Realm', 'controller': 'realms', 'setup': entities.Realm, 'session_name': 'realm'},
{'name': 'Location', 'controller': 'locations', 'session_name': 'location'},
{'name': 'Organization', 'controller': 'organizations', 'session_name': 'organization'},
{'name': 'User', 'controller': 'users', 'session_name': 'user'},
{
'name': 'UserGroup',
'controller': 'usergroups',
'setup': entities.UserGroup,
'session_name': 'usergroup',
},
{'name': 'Role', 'controller': 'roles', 'session_name': 'role'},
{'name': 'Settings', 'controller': 'settings', 'session_name': 'settings'},
{'name': 'Repository', 'controller': 'katello_repositories', 'session_name': 'repository'},
]

STRING_TYPES = ['alpha', 'numeric', 'alphanumeric', 'latin1', 'utf8', 'cjk', 'html']
Expand Down
4 changes: 2 additions & 2 deletions tests/foreman/api/test_bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import pytest
from requests.exceptions import HTTPError

from robottelo.constants import BOOKMARK_ENTITIES
from robottelo.constants import BOOKMARK_ENTITIES_SELECTION
from robottelo.utils.datafactory import invalid_values_list, valid_data_list

# List of unique bookmark controller values, preserving order
CONTROLLERS = list(dict.fromkeys(entity['controller'] for entity in BOOKMARK_ENTITIES))
CONTROLLERS = list(dict.fromkeys(entity['controller'] for entity in BOOKMARK_ENTITIES_SELECTION))


@pytest.mark.tier1
Expand Down
6 changes: 4 additions & 2 deletions tests/foreman/ui/test_bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
import pytest

from robottelo.config import user_nailgun_config
from robottelo.constants import BOOKMARK_ENTITIES
from robottelo.constants import BOOKMARK_ENTITIES_SELECTION


@pytest.fixture(
scope='module', params=BOOKMARK_ENTITIES, ids=(i['name'] for i in BOOKMARK_ENTITIES)
scope='module',
params=BOOKMARK_ENTITIES_SELECTION,
ids=(i['name'] for i in BOOKMARK_ENTITIES_SELECTION),
)
def ui_entity(module_org, module_location, request):
"""Collects the list of all applicable UI entities for testing and does all
Expand Down
10 changes: 5 additions & 5 deletions tests/upgrades/test_bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""
import pytest

from robottelo.constants import BOOKMARK_ENTITIES
from robottelo.constants import BOOKMARK_ENTITIES_SELECTION


class TestPublicDisableBookmark:
Expand Down Expand Up @@ -45,7 +45,7 @@ def test_pre_create_public_disable_bookmark(self, request, target_sat):
:CaseImportance: Critical
"""

for entity in BOOKMARK_ENTITIES:
for entity in BOOKMARK_ENTITIES_SELECTION:
book_mark_name = entity["name"] + request.node.name
bm = target_sat.api.Bookmark(
controller=entity['controller'],
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_post_create_public_disable_bookmark(self, dependent_scenario_name, targ
:CaseImportance: Critical
"""
pre_test_name = dependent_scenario_name
for entity in BOOKMARK_ENTITIES:
for entity in BOOKMARK_ENTITIES_SELECTION:
book_mark_name = entity["name"] + pre_test_name
bm = target_sat.api.Bookmark().search(query={'search': f'name="{book_mark_name}"'})[0]
assert bm.controller == entity['controller']
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_pre_create_public_enable_bookmark(self, request, target_sat):
:customerscenario: true
"""

for entity in BOOKMARK_ENTITIES:
for entity in BOOKMARK_ENTITIES_SELECTION:
book_mark_name = entity["name"] + request.node.name
bm = target_sat.api.Bookmark(
controller=entity['controller'],
Expand Down Expand Up @@ -145,7 +145,7 @@ def test_post_create_public_enable_bookmark(self, dependent_scenario_name, targe
:CaseImportance: Critical
"""
pre_test_name = dependent_scenario_name
for entity in BOOKMARK_ENTITIES:
for entity in BOOKMARK_ENTITIES_SELECTION:
book_mark_name = entity["name"] + pre_test_name
bm = target_sat.api.Bookmark().search(query={'search': f'name="{book_mark_name}"'})[0]
assert bm.controller == entity['controller']
Expand Down

0 comments on commit 3aec412

Please sign in to comment.