mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
test_webui: Don't use __init__ for test classes
https://fedorahosted.org/freeipa/ticket/4610 Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
parent
b64f91fb43
commit
82e41dc7a4
@ -93,6 +93,7 @@ class test_automember(UI_driver):
|
|||||||
self.init_app()
|
self.init_app()
|
||||||
|
|
||||||
host_util = host_tasks()
|
host_util = host_tasks()
|
||||||
|
host_util.setup(self.driver, self.config)
|
||||||
domain = self.config.get('ipa_domain')
|
domain = self.config.get('ipa_domain')
|
||||||
host1 = 'web1.%s' % domain
|
host1 = 'web1.%s' % domain
|
||||||
host2 = 'web2.%s' % domain
|
host2 = 'web2.%s' % domain
|
||||||
|
@ -29,8 +29,8 @@ ENTITY = 'cert'
|
|||||||
|
|
||||||
class test_cert(UI_driver):
|
class test_cert(UI_driver):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def setup(self, *args, **kwargs):
|
||||||
super(test_cert, self).__init__(args, kwargs)
|
super(test_cert, self).setup(*args, **kwargs)
|
||||||
|
|
||||||
if not self.has_ca():
|
if not self.has_ca():
|
||||||
self.skip('CA not configured')
|
self.skip('CA not configured')
|
||||||
|
@ -87,8 +87,8 @@ CONFIG_MOD_DATA = {
|
|||||||
|
|
||||||
class test_dns(UI_driver):
|
class test_dns(UI_driver):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def setup(self, *args, **kwargs):
|
||||||
super(test_dns, self).__init__(args, kwargs)
|
super(test_dns, self).setup(*args, **kwargs)
|
||||||
|
|
||||||
if not self.has_dns():
|
if not self.has_dns():
|
||||||
self.skip('DNS not configured')
|
self.skip('DNS not configured')
|
||||||
|
@ -34,8 +34,8 @@ ENTITY = 'host'
|
|||||||
|
|
||||||
class host_tasks(UI_driver):
|
class host_tasks(UI_driver):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def setup(self, *args, **kwargs):
|
||||||
super(host_tasks, self).__init__(args, kwargs)
|
super(host_tasks, self).setup(*args, **kwargs)
|
||||||
self.prep_data()
|
self.prep_data()
|
||||||
self.prep_data2()
|
self.prep_data2()
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ class test_hostgroup(UI_driver):
|
|||||||
Hostgroup associations
|
Hostgroup associations
|
||||||
"""
|
"""
|
||||||
self.init_app()
|
self.init_app()
|
||||||
host = host_tasks(self.driver, self.config)
|
host = host_tasks()
|
||||||
|
host.setup(self.driver, self.config)
|
||||||
|
|
||||||
# prepare
|
# prepare
|
||||||
# -------
|
# -------
|
||||||
@ -89,7 +90,8 @@ class test_hostgroup(UI_driver):
|
|||||||
Hostgroup indirect associations
|
Hostgroup indirect associations
|
||||||
"""
|
"""
|
||||||
self.init_app()
|
self.init_app()
|
||||||
host = host_tasks(self.driver, self.config)
|
host = host_tasks()
|
||||||
|
host.setup(self.driver, self.config)
|
||||||
|
|
||||||
# add
|
# add
|
||||||
# ---
|
# ---
|
||||||
|
@ -46,7 +46,8 @@ class test_netgroup(UI_driver):
|
|||||||
Mod: netgroup
|
Mod: netgroup
|
||||||
"""
|
"""
|
||||||
self.init_app()
|
self.init_app()
|
||||||
host = host_tasks(self.driver, self.config)
|
host = host_tasks()
|
||||||
|
host.setup(self.driver, self.config)
|
||||||
|
|
||||||
self.add_record(netgroup.ENTITY, netgroup.DATA2)
|
self.add_record(netgroup.ENTITY, netgroup.DATA2)
|
||||||
self.add_record(user.ENTITY, user.DATA)
|
self.add_record(user.ENTITY, user.DATA)
|
||||||
|
@ -95,9 +95,8 @@ class trust_tasks(UI_driver):
|
|||||||
|
|
||||||
class test_trust(trust_tasks):
|
class test_trust(trust_tasks):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def setup(self, *args, **kwargs):
|
||||||
super(test_trust, self).__init__(args, kwargs)
|
super(test_trust, self).setup(*args, **kwargs)
|
||||||
|
|
||||||
if not self.has_trusts():
|
if not self.has_trusts():
|
||||||
self.skip('Trusts not configured')
|
self.skip('Trusts not configured')
|
||||||
|
|
||||||
@ -121,7 +120,8 @@ class test_trust(trust_tasks):
|
|||||||
|
|
||||||
self.init_app()
|
self.init_app()
|
||||||
|
|
||||||
r_tasks = range_tasks(self.driver, self.config)
|
r_tasks = range_tasks()
|
||||||
|
r_tasks.setup(self.driver, self.config)
|
||||||
r_tasks.get_shifts()
|
r_tasks.get_shifts()
|
||||||
range_add = r_tasks.get_add_data('')
|
range_add = r_tasks.get_add_data('')
|
||||||
base_id = range_add[2][2]
|
base_id = range_add[2][2]
|
||||||
|
@ -117,12 +117,18 @@ class UI_driver(object):
|
|||||||
if NO_SELENIUM:
|
if NO_SELENIUM:
|
||||||
raise nose.SkipTest('Selenium not installed')
|
raise nose.SkipTest('Selenium not installed')
|
||||||
|
|
||||||
def __init__(self, driver=None, config=None):
|
def setup(self, driver=None, config=None):
|
||||||
self.request_timeout = 30
|
self.request_timeout = 30
|
||||||
self.driver = driver
|
self.driver = driver
|
||||||
self.config = config
|
self.config = config
|
||||||
if not config:
|
if not config:
|
||||||
self.load_config()
|
self.load_config()
|
||||||
|
if not self.driver:
|
||||||
|
self.driver = self.get_driver()
|
||||||
|
self.get_driver().maximize_window()
|
||||||
|
|
||||||
|
def teardown(self):
|
||||||
|
self.driver.quit()
|
||||||
|
|
||||||
def load_config(self):
|
def load_config(self):
|
||||||
"""
|
"""
|
||||||
@ -161,20 +167,6 @@ class UI_driver(object):
|
|||||||
if 'type' not in c:
|
if 'type' not in c:
|
||||||
c['type'] = DEFAULT_TYPE
|
c['type'] = DEFAULT_TYPE
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
"""
|
|
||||||
Test setup
|
|
||||||
"""
|
|
||||||
if not self.driver:
|
|
||||||
self.driver = self.get_driver()
|
|
||||||
self.driver.maximize_window()
|
|
||||||
|
|
||||||
def teardown(self):
|
|
||||||
"""
|
|
||||||
Test clean up
|
|
||||||
"""
|
|
||||||
self.driver.quit()
|
|
||||||
|
|
||||||
def get_driver(self):
|
def get_driver(self):
|
||||||
"""
|
"""
|
||||||
Get WebDriver according to configuration
|
Get WebDriver according to configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user