Skip to content

Commit

Permalink
remove the all nailgum imports from UI folder
Browse files Browse the repository at this point in the history
  • Loading branch information
omkarkhatavkar committed Jan 29, 2024
1 parent 97bc06c commit 1fd56df
Show file tree
Hide file tree
Showing 22 changed files with 194 additions and 186 deletions.
5 changes: 2 additions & 3 deletions tests/foreman/ui/test_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
"""
from fauxfactory import gen_string
from nailgun import entities
import pytest


@pytest.mark.tier2
@pytest.mark.upgrade
def test_positive_end_to_end(session):
def test_positive_end_to_end(session, target_sat):
"""Perform end to end testing for architecture component
:id: eef14b29-9f5a-41aa-805e-73398ed2b112
Expand All @@ -29,7 +28,7 @@ def test_positive_end_to_end(session):
"""
name = gen_string('alpha')
new_name = gen_string('alpha')
os = entities.OperatingSystem().create()
os = target_sat.api.OperatingSystem().create()
os_name = f'{os.name} {os.major}'
with session:
# Create new architecture with assigned operating system
Expand Down
21 changes: 10 additions & 11 deletions tests/foreman/ui/test_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@
"""
from fauxfactory import gen_string
from nailgun import entities
import pytest

from robottelo.constants import ENVIRONMENT


@pytest.fixture(scope='module')
def module_org():
return entities.Organization().create()
def module_org(module_target_sat):
return module_target_sat.api.Organization().create()


pytestmark = [pytest.mark.run_in_one_thread]


@pytest.mark.tier2
@pytest.mark.upgrade
def test_positive_create_event(session, module_org, module_location):
def test_positive_create_event(session, module_org, module_location, module_target_sat):
"""When new host is created, corresponding audit entry appear in the application
:id: d0595705-f4b2-4f06-888b-ee93edd4acf8
Expand All @@ -39,7 +38,7 @@ def test_positive_create_event(session, module_org, module_location):
:BZ: 1730360
"""
host = entities.Host(organization=module_org, location=module_location).create()
host = module_target_sat.api.Host(organization=module_org, location=module_location).create()
with session:
session.organization.select(org_name=module_org.name)
session.location.select(loc_name=module_location.name)
Expand Down Expand Up @@ -103,7 +102,7 @@ def test_positive_audit_comment(session, module_org):


@pytest.mark.tier2
def test_positive_update_event(session, module_org):
def test_positive_update_event(session, module_org, module_target_sat):
"""When existing content view is updated, corresponding audit entry appear
in the application
Expand All @@ -119,7 +118,7 @@ def test_positive_update_event(session, module_org):
"""
name = gen_string('alpha')
new_name = gen_string('alpha')
cv = entities.ContentView(name=name, organization=module_org).create()
cv = module_target_sat.api.ContentView(name=name, organization=module_org).create()
cv.name = new_name
cv.update(['name'])
with session:
Expand All @@ -135,7 +134,7 @@ def test_positive_update_event(session, module_org):


@pytest.mark.tier2
def test_positive_delete_event(session, module_org):
def test_positive_delete_event(session, module_org, module_target_sat):
"""When existing architecture is deleted, corresponding audit entry appear
in the application
Expand All @@ -147,7 +146,7 @@ def test_positive_delete_event(session, module_org):
:CaseImportance: Medium
"""
architecture = entities.Architecture().create()
architecture = module_target_sat.api.Architecture().create()
architecture.delete()
with session:
values = session.audit.search('type=architecture and action=destroy')
Expand All @@ -160,7 +159,7 @@ def test_positive_delete_event(session, module_org):


@pytest.mark.tier2
def test_positive_add_event(session, module_org):
def test_positive_add_event(session, module_org, module_target_sat):
"""When content view is published and proper lifecycle environment added to it,
corresponding audit entry appear in the application
Expand All @@ -172,7 +171,7 @@ def test_positive_add_event(session, module_org):
:CaseImportance: Medium
"""
cv = entities.ContentView(organization=module_org).create()
cv = module_target_sat.api.ContentView(organization=module_org).create()
cv.publish()
with session:
values = session.audit.search(
Expand Down
15 changes: 9 additions & 6 deletions tests/foreman/ui/test_computeprofiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
"""
from fauxfactory import gen_string
from nailgun import entities
import pytest


@pytest.mark.tier2
@pytest.mark.upgrade
def test_positive_end_to_end(session, module_location, module_org):
def test_positive_end_to_end(session, module_location, module_org, module_target_sat):
"""Perform end to end testing for compute profile component
:id: 5445fc7e-7b3f-472f-8a94-93f89aca6c22
Expand All @@ -29,13 +28,13 @@ def test_positive_end_to_end(session, module_location, module_org):
"""
name = gen_string('alpha')
new_name = gen_string('alpha')
compute_resource = entities.LibvirtComputeResource(
compute_resource = module_target_sat.api.LibvirtComputeResource(
location=[module_location], organization=[module_org], url='qemu+ssh://root@test/system'
).create()
with session:
session.computeprofile.create({'name': name})

assert entities.ComputeProfile().search(query={'search': f'name={name}'}), (
assert module_target_sat.api.ComputeProfile().search(query={'search': f'name={name}'}), (
'Compute profile {} expected to exist, but is not included in the search '
'results'.format(name)
)
Expand All @@ -44,12 +43,16 @@ def test_positive_end_to_end(session, module_location, module_org):
resource['Compute Resource'] for resource in compute_resource_list
]
session.computeprofile.rename(name, {'name': new_name})
assert entities.ComputeProfile().search(query={'search': f'name={new_name}'}), (
assert module_target_sat.api.ComputeProfile().search(
query={'search': f'name={new_name}'}
), (
'Compute profile {} expected to exist, but is not included in the search '
'results'.format(new_name)
)
session.computeprofile.delete(new_name)
assert not entities.ComputeProfile().search(query={'search': f'name={new_name}'}), (
assert not module_target_sat.api.ComputeProfile().search(
query={'search': f'name={new_name}'}
), (
'Compute profile {} expected to be deleted, but is included in the search '
'results'.format(new_name)
)
43 changes: 24 additions & 19 deletions tests/foreman/ui/test_computeresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
:CaseImportance: High
"""
from nailgun import entities
import pytest
from wait_for import wait_for

Expand Down Expand Up @@ -48,7 +47,7 @@ def rhev_data():


@pytest.mark.tier2
def test_positive_end_to_end(session, rhev_data, module_org, module_location):
def test_positive_end_to_end(session, rhev_data, module_org, module_location, module_target_sat):
"""Perform end to end testing for compute resource RHEV.
:id: 3c079675-e5d3-490e-9b7e-1c2950f9965d
Expand Down Expand Up @@ -85,7 +84,9 @@ def test_positive_end_to_end(session, rhev_data, module_org, module_location):
assert not session.computeresource.search(name)
assert session.computeresource.search(new_name)[0]['Name'] == new_name
session.computeresource.delete(new_name)
assert not entities.AbstractComputeResource().search(query={'search': f'name={new_name}'})
assert not module_target_sat.api.AbstractComputeResource().search(
query={'search': f'name={new_name}'}
)


@pytest.mark.tier2
Expand Down Expand Up @@ -225,7 +226,7 @@ def test_positive_resource_vm_power_management(session, rhev_data):


@pytest.mark.tier3
def test_positive_VM_import(session, module_org, module_location, rhev_data):
def test_positive_VM_import(session, module_org, module_location, rhev_data, module_target_sat):
"""Import an existing VM as a Host
:id: 47aea4b7-9258-4863-8966-9a0bc9e94116
Expand All @@ -239,34 +240,38 @@ def test_positive_VM_import(session, module_org, module_location, rhev_data):
:BZ: 1636067
"""
# create entities for hostgroup
default_loc_id = entities.Location().search(query={'search': f'name="{DEFAULT_LOC}"'})[0].id
entities.SmartProxy(id=1, location=[default_loc_id, module_location.id]).update()
domain = entities.Domain(organization=[module_org.id], location=[module_location]).create()
subnet = entities.Subnet(
default_loc_id = (
module_target_sat.api.Location().search(query={'search': f'name="{DEFAULT_LOC}"'})[0].id
)
module_target_sat.api.SmartProxy(id=1, location=[default_loc_id, module_location.id]).update()
domain = module_target_sat.api.Domain(
organization=[module_org.id], location=[module_location]
).create()
subnet = module_target_sat.api.Subnet(
organization=[module_org.id], location=[module_location], domain=[domain]
).create()
architecture = entities.Architecture().create()
ptable = entities.PartitionTable(
architecture = module_target_sat.api.Architecture().create()
ptable = module_target_sat.api.PartitionTable(
organization=[module_org.id], location=[module_location]
).create()
operatingsystem = entities.OperatingSystem(
operatingsystem = module_target_sat.api.OperatingSystem(
architecture=[architecture], ptable=[ptable]
).create()
medium = entities.Media(
medium = module_target_sat.api.Media(
organization=[module_org.id], location=[module_location], operatingsystem=[operatingsystem]
).create()
le = (
entities.LifecycleEnvironment(name="Library", organization=module_org.id)
module_target_sat.api.LifecycleEnvironment(name="Library", organization=module_org.id)
.search()[0]
.read()
.id
)
cv = entities.ContentView(organization=module_org).create()
cv = module_target_sat.api.ContentView(organization=module_org).create()
cv.publish()

# create hostgroup
hostgroup_name = gen_string('alpha')
entities.HostGroup(
module_target_sat.api.HostGroup(
name=hostgroup_name,
architecture=architecture,
domain=domain,
Expand Down Expand Up @@ -302,14 +307,14 @@ def test_positive_VM_import(session, module_org, module_location, rhev_data):
)
assert session.host.search(rhev_data['vm_name']) is not None
# disassociate the host so the corresponding VM doesn't get removed from the CR on host delete
entities.Host().search(query={'search': 'name~{}'.format(rhev_data['vm_name'])})[
module_target_sat.api.Host().search(query={'search': 'name~{}'.format(rhev_data['vm_name'])})[
0
].disassociate()
entities.Host(name=rhev_data['vm_name']).search()[0].delete()
module_target_sat.api.Host(name=rhev_data['vm_name']).search()[0].delete()


@pytest.mark.tier3
def test_positive_update_organization(session, rhev_data, module_location):
def test_positive_update_organization(session, rhev_data, module_location, module_target_sat):
"""Update a rhev Compute Resource organization
:id: f6656c8e-70a3-40e5-8dda-2154f2eeb042
Expand All @@ -334,7 +339,7 @@ def test_positive_update_organization(session, rhev_data, module_location):
:expectedresults: The rhev Compute Resource is updated
"""
name = gen_string('alpha')
new_organization = entities.Organization().create()
new_organization = module_target_sat.api.Organization().create()
with session:
session.computeresource.create(
{
Expand Down
9 changes: 4 additions & 5 deletions tests/foreman/ui/test_computeresource_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"""
from fauxfactory import gen_string
from nailgun import entities
import pytest

from robottelo.config import settings
Expand Down Expand Up @@ -44,7 +43,7 @@ def module_ec2_settings():
@pytest.mark.skip_if_not_set('http_proxy')
@pytest.mark.skip_if_open("BZ:2032530")
def test_positive_default_end_to_end_with_custom_profile(
session, module_org, module_location, module_ec2_settings
session, module_org, module_location, module_ec2_settings, module_target_sat
):
"""Create EC2 compute resource with default properties and apply it's basic functionality.
Expand All @@ -67,9 +66,9 @@ def test_positive_default_end_to_end_with_custom_profile(
cr_name = gen_string('alpha')
new_cr_name = gen_string('alpha')
cr_description = gen_string('alpha')
new_org = entities.Organization().create()
new_loc = entities.Location().create()
http_proxy = entities.HTTPProxy(
new_org = module_target_sat.api.Organization().create()
new_loc = module_target_sat.api.Location().create()
http_proxy = module_target_sat.api.HTTPProxy(
name=gen_string('alpha', 15),
url=settings.http_proxy.auth_proxy_url,
username=settings.http_proxy.username,
Expand Down
7 changes: 3 additions & 4 deletions tests/foreman/ui/test_computeresource_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from math import floor, log10
from random import choice

from nailgun import entities
import pytest
from wait_for import TimedOutError, wait_for
from wrapanapi.systems.virtualcenter import VMWareSystem, vim
Expand Down Expand Up @@ -81,7 +80,7 @@ def _get_vmware_datastore_summary_string(data_store_name=settings.vmware.datasto


@pytest.mark.tier1
def test_positive_end_to_end(session, module_org, module_location):
def test_positive_end_to_end(session, module_org, module_location, module_target_sat):
"""Perform end to end testing for compute resource VMware component.
:id: 47fc9e77-5b22-46b4-a76c-3217434fde2f
Expand All @@ -94,8 +93,8 @@ def test_positive_end_to_end(session, module_org, module_location):
display_type = choice(('VNC', 'VMRC'))
vnc_console_passwords = choice((False, True))
enable_caching = choice((False, True))
new_org = entities.Organization().create()
new_loc = entities.Location().create()
new_org = module_target_sat.api.Organization().create()
new_loc = module_target_sat.api.Location().create()
with session:
session.computeresource.create(
{
Expand Down
13 changes: 6 additions & 7 deletions tests/foreman/ui/test_containerimagetag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
:CaseImportance: High
"""
from nailgun import entities
import pytest

from robottelo.constants import (
Expand All @@ -25,18 +24,18 @@


@pytest.fixture(scope="module")
def module_org():
return entities.Organization().create()
def module_org(module_target_sat):
return module_target_sat.api.Organization().create()


@pytest.fixture(scope="module")
def module_product(module_org):
return entities.Product(organization=module_org).create()
def module_product(module_org, module_target_sat):
return module_target_sat.api.Product(organization=module_org).create()


@pytest.fixture(scope="module")
def module_repository(module_product):
repo = entities.Repository(
def module_repository(module_product, module_target_sat):
repo = module_target_sat.api.Repository(
content_type=REPO_TYPE['docker'],
docker_upstream_name=CONTAINER_UPSTREAM_NAME,
product=module_product,
Expand Down
7 changes: 4 additions & 3 deletions tests/foreman/ui/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"""
from fauxfactory import gen_string
from nailgun import entities
import pytest

from robottelo.utils.datafactory import valid_domain_names
Expand Down Expand Up @@ -113,7 +112,9 @@ def test_positive_remove_parameter(session, valid_domain_name):
@pytest.mark.e2e
@pytest.mark.tier2
@pytest.mark.upgrade
def test_positive_end_to_end(session, module_org, module_location, valid_domain_name):
def test_positive_end_to_end(
session, module_org, module_location, valid_domain_name, module_target_sat
):
"""Perform end to end testing for domain component
:id: ce90fd87-3e63-4298-a771-38f4aacce091
Expand Down Expand Up @@ -148,4 +149,4 @@ def test_positive_end_to_end(session, module_org, module_location, valid_domain_
assert session.domain.search(new_name)[0]['Description'] == new_name
# Delete domain
session.domain.delete(new_name)
assert not entities.Domain().search(query={'search': f'name={new_name}'})
assert not module_target_sat.api.Domain().search(query={'search': f'name={new_name}'})
Loading

0 comments on commit 1fd56df

Please sign in to comment.