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

Fix UI REX tests #5753

Merged
merged 1 commit into from
Jan 5, 2018
Merged
Show file tree
Hide file tree
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
11 changes: 3 additions & 8 deletions tests/foreman/cli/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def setUpClass(cls):
'''echo 'getenforce' > {0}'''.format(TEMPLATE_FILE)
)
# create subnet for current org, default loc and domain
# add rex proxy to subnet, default is internal proxy (id 1)
# using API due BZ#1370460
cls.sn = entities.Subnet(
domain=[1],
Expand All @@ -265,15 +266,9 @@ def setUpClass(cls):
location=[DEFAULT_LOC_ID],
mask=settings.vlan_networking.netmask,
network=settings.vlan_networking.subnet,
organization=[cls.org.id]
organization=[cls.org.id],
remote_execution_proxy=[entities.SmartProxy(id=1)],
).create()
# add rex proxy to subnet, default is internal proxy (id 1)
if bz_bug_is_open(1328322):
cls.sn.remote_execution_proxy_ids = [1]
cls.sn.update(["remote_execution_proxy_ids"])
else:
cls.sn.remote_execution_proxy_id = 1
cls.sn.update(["remote_execution_proxy_id"])

def setUp(self):
"""Create VM, install katello-ca, register it, add remote execution key
Expand Down
48 changes: 21 additions & 27 deletions tests/foreman/ui/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
"""
from datetime import datetime, timedelta
from nailgun import entities
from robottelo.constants import OS_TEMPLATE_DATA_FILE, DISTRO_RHEL7
from robottelo.constants import (
DEFAULT_LOC_ID,
DISTRO_RHEL7,
OS_TEMPLATE_DATA_FILE,
)
from robottelo.config import settings
from robottelo.datafactory import (
gen_string,
Expand All @@ -25,7 +29,6 @@
)
from robottelo.cli.job_invocation import JobInvocation
from robottelo.decorators import (
bz_bug_is_open,
skip_if_not_set,
stubbed,
tier1,
Expand All @@ -34,7 +37,6 @@
upgrade,
)
from robottelo.helpers import add_remote_execution_ssh_key, get_data_file
from robottelo.cli.factory import make_subnet
from robottelo.cli.host import Host
from robottelo.test import UITestCase
from robottelo.ui.factory import make_job_template, set_context
Expand Down Expand Up @@ -454,25 +456,17 @@ def setUpClass(cls):
"""Create an organization which can be re-used in tests."""
super(RemoteExecutionTestCase, cls).setUpClass()
cls.organization = entities.Organization().create()
# create subnet for current org, default loc and domain
# add rex proxy to subnet, default is internal proxy (id 1)
subnet_options = {
u'domain-ids': 1,
u'gateway': settings.vlan_networking.gateway,
u'ipam': u'DHCP',
u'location-ids': 2,
u'mask': settings.vlan_networking.netmask,
u'network': settings.vlan_networking.subnet,
u'network-type': 'IPv4',
u'organizations': cls.organization.name
}
if not bz_bug_is_open(1328322):
subnet_options[u'remote-execution-proxy-id'] = 1
cls.new_sub = make_subnet(subnet_options)
if bz_bug_is_open(1328322):
subnet = entities.Subnet(id=cls.new_sub["id"])
subnet.remote_execution_proxy_ids = [1]
subnet.update(["remote_execution_proxy_ids"])
cls.new_sub = entities.Subnet(
domain=[entities.Domain(id=1)],
gateway=settings.vlan_networking.gateway,
ipam='DHCP',
location=[entities.Location(id=DEFAULT_LOC_ID)],
mask=settings.vlan_networking.netmask,
network=settings.vlan_networking.subnet,
network_type='IPv4',
remote_execution_proxy=[entities.SmartProxy(id=1)],
organization=[cls.organization],
).create()

def get_client_datetime(self):
"""Make Javascript call inside of browser session to get exact current
Expand Down Expand Up @@ -528,7 +522,7 @@ def test_positive_run_default_job_template(self):
add_remote_execution_ssh_key(client.ip_addr)
Host.update({
u'name': client.hostname,
u'subnet-id': self.new_sub['id'],
u'subnet-id': self.new_sub.id,
})
with Session(self) as session:
set_context(session, org=self.organization.name)
Expand Down Expand Up @@ -661,7 +655,7 @@ def test_positive_run_default_job_template_by_ip(self):
add_remote_execution_ssh_key(client.ip_addr)
Host.update({
'name': client.hostname,
'subnet-id': self.new_sub['id'],
'subnet-id': self.new_sub.id,
})
# connect to host by ip
Host.set_parameter({
Expand Down Expand Up @@ -721,7 +715,7 @@ def test_positive_run_custom_job_template_by_ip(self):
add_remote_execution_ssh_key(client.ip_addr)
Host.update({
'name': client.hostname,
'subnet-id': self.new_sub['id'],
'subnet-id': self.new_sub.id,
})
# connect to host by ip
Host.set_parameter({
Expand Down Expand Up @@ -801,7 +795,7 @@ def test_positive_run_job_template_multiple_hosts_by_ip(self):
add_remote_execution_ssh_key(vm.ip_addr)
Host.update({
'name': vm.hostname,
'subnet-id': self.new_sub['id'],
'subnet-id': self.new_sub.id,
})
# connect to host by ip
Host.set_parameter({
Expand Down Expand Up @@ -870,7 +864,7 @@ def test_positive_run_scheduled_job_template_by_ip(self):
add_remote_execution_ssh_key(client.ip_addr)
Host.update({
'name': client.hostname,
'subnet-id': self.new_sub['id'],
'subnet-id': self.new_sub.id,
})
# connect to host by ip
Host.set_parameter({
Expand Down