Web UI integration tests: PEP8 fixes

Tests modified to comply with PEP8 rules with exception of rule E501 (long lines).
Done by autopep8 tool and 2 manual modifications.

https://fedorahosted.org/freeipa/ticket/3744
This commit is contained in:
Petr Vobornik 2013-07-24 13:24:02 +02:00
parent 8a3d8aeca3
commit 6ec5e5fec6
29 changed files with 176 additions and 186 deletions

View File

@ -25,11 +25,11 @@ DATA = {
'pkey': PKEY,
'add': [
('textbox', 'cn', PKEY),
('textarea', 'description','test-group desc'),
('radio', 'type','normal'),
('textarea', 'description', 'test-group desc'),
('radio', 'type', 'normal'),
],
'mod': [
('textarea', 'description','test-group desc modified'),
('textarea', 'description', 'test-group desc modified'),
],
}
@ -38,33 +38,33 @@ DATA2 = {
'pkey': PKEY2,
'add': [
('textbox', 'cn', PKEY2),
('textarea', 'description','test-group2 desc'),
('textarea', 'description', 'test-group2 desc'),
]
}
PKEY3 = 'itest-group3'
DATA3= {
DATA3 = {
'pkey': PKEY3,
'add': [
('textbox', 'cn', PKEY3),
('textarea', 'description','test-group3 desc'),
('textarea', 'description', 'test-group3 desc'),
]
}
PKEY4 = 'itest-group4'
DATA4= {
DATA4 = {
'pkey': PKEY4,
'add': [
('textbox', 'cn', PKEY4),
('textarea', 'description','test-group4 desc'),
('textarea', 'description', 'test-group4 desc'),
]
}
PKEY5 = 'itest-group5'
DATA5= {
DATA5 = {
'pkey': PKEY5,
'add': [
('textbox', 'cn', PKEY5),
('textarea', 'description','test-group5 desc'),
('textarea', 'description', 'test-group5 desc'),
]
}

View File

@ -25,10 +25,10 @@ DATA = {
'pkey': PKEY,
'add': [
('textbox', 'cn', PKEY),
('textarea', 'description','test-hostgroup desc'),
('textarea', 'description', 'test-hostgroup desc'),
],
'mod': [
('textarea', 'description','test-hostgroup desc modified'),
('textarea', 'description', 'test-hostgroup desc modified'),
],
}
@ -37,10 +37,10 @@ DATA2 = {
'pkey': PKEY2,
'add': [
('textbox', 'cn', PKEY2),
('textarea', 'description','test-hostgroup2 desc'),
('textarea', 'description', 'test-hostgroup2 desc'),
],
'mod': [
('textarea', 'description','test-hostgroup2 desc modified'),
('textarea', 'description', 'test-hostgroup2 desc modified'),
],
}
@ -49,10 +49,10 @@ DATA3 = {
'pkey': PKEY3,
'add': [
('textbox', 'cn', PKEY3),
('textarea', 'description','test-hostgroup3 desc'),
('textarea', 'description', 'test-hostgroup3 desc'),
],
'mod': [
('textarea', 'description','test-hostgroup3 desc modified'),
('textarea', 'description', 'test-hostgroup3 desc modified'),
],
}
@ -61,10 +61,10 @@ DATA4 = {
'pkey': PKEY4,
'add': [
('textbox', 'cn', PKEY4),
('textarea', 'description','test-hostgroup4 desc'),
('textarea', 'description', 'test-hostgroup4 desc'),
],
'mod': [
('textarea', 'description','test-hostgroup4 desc modified'),
('textarea', 'description', 'test-hostgroup4 desc modified'),
],
}
@ -73,9 +73,9 @@ DATA5 = {
'pkey': PKEY5,
'add': [
('textbox', 'cn', PKEY5),
('textarea', 'description','test-hostgroup5 desc'),
('textarea', 'description', 'test-hostgroup5 desc'),
],
'mod': [
('textarea', 'description','test-hostgroup5 desc modified'),
('textarea', 'description', 'test-hostgroup5 desc modified'),
],
}

View File

@ -34,8 +34,8 @@ DATA = {
('label', 'uid', PKEY),
],
'mod': [
('textbox', 'givenname','OtherName'),
('textbox', 'sn','OtherSurname'),
('textbox', 'givenname', 'OtherName'),
('textbox', 'sn', 'OtherSurname'),
('multivalued', 'telephonenumber', [
('add', '123456789'),
('add', '987654321'),
@ -59,7 +59,7 @@ DATA2 = {
('textbox', 'sn', 'Surname2'),
],
'mod': [
('textbox', 'givenname','OtherName2'),
('textbox', 'sn','OtherSurname2'),
('textbox', 'givenname', 'OtherName2'),
('textbox', 'sn', 'OtherSurname2'),
],
}

View File

@ -34,18 +34,6 @@ USER_GROUP_DATA = {
],
'mod': [
('textarea', 'description', 'user group rule description'),
#(
#'add_table_record',
#'automemberinclusiveregex',
#(
#'table-widget',
#{
#'fields': [
#('textbox', 'automemberinclusiveregex', 'testregex')
#]
#},
#)
#)
],
}
@ -59,6 +47,7 @@ HOST_GROUP_DATA = {
],
}
class test_automember(UI_driver):
def test_crud(self):
@ -69,10 +58,10 @@ class test_automember(UI_driver):
# user group rule
self.basic_crud(ENTITY, USER_GROUP_DATA,
search_facet='searchgroup',
default_facet='usergrouprule',
details_facet='usergrouprule',
)
search_facet='searchgroup',
default_facet='usergrouprule',
details_facet='usergrouprule',
)
# prepare host group
self.basic_crud(hostgroup.ENTITY, hostgroup.DATA,
@ -83,12 +72,12 @@ class test_automember(UI_driver):
self.navigate_by_menu('policy/automember/amhostgroup')
self.basic_crud(ENTITY, HOST_GROUP_DATA,
search_facet='searchhostgroup',
default_facet='hostgrouprule',
details_facet='hostgrouprule',
navigate=False,
breadcrumb='Host group rules',
)
search_facet='searchhostgroup',
default_facet='hostgrouprule',
details_facet='hostgrouprule',
navigate=False,
breadcrumb='Host group rules',
)
# cleanup
self.delete(hostgroup.ENTITY, [hostgroup.DATA])

View File

@ -59,6 +59,7 @@ KEY_DATA = {
]
}
class test_automount(UI_driver):
def test_crud(self):
@ -69,32 +70,32 @@ class test_automount(UI_driver):
# location
self.basic_crud(LOC_ENTITY, LOC_DATA,
default_facet='maps',
delete=False,
breadcrumb='Automount Locations'
)
default_facet='maps',
delete=False,
breadcrumb='Automount Locations'
)
# map
self.navigate_to_record(LOC_PKEY)
self.basic_crud(MAP_ENTITY, MAP_DATA,
parent_entity=LOC_ENTITY,
search_facet='maps',
default_facet='keys',
delete=False,
navigate=False,
breadcrumb=LOC_PKEY,
)
parent_entity=LOC_ENTITY,
search_facet='maps',
default_facet='keys',
delete=False,
navigate=False,
breadcrumb=LOC_PKEY,
)
# key
self.navigate_to_record(MAP_PKEY)
self.basic_crud(KEY_ENTITY, KEY_DATA,
parent_entity=MAP_ENTITY,
search_facet='keys',
navigate=False,
breadcrumb=MAP_PKEY,
)
parent_entity=MAP_ENTITY,
search_facet='keys',
navigate=False,
breadcrumb=MAP_PKEY,
)
# delete
self.navigate_by_breadcrumb(LOC_PKEY)

View File

@ -25,6 +25,7 @@ from ipatests.test_webui.ui_driver import UI_driver
ENTITY = 'cert'
class test_cert(UI_driver):
def __init__(self, *args, **kwargs):
@ -33,7 +34,6 @@ class test_cert(UI_driver):
if not self.has_ca():
self.skip('CA not configured')
def test_read(self):
"""
Basic read: cert

View File

@ -27,18 +27,19 @@ ENTITY = 'config'
DATA = {
'mod': [
('textbox', 'ipasearchrecordslimit','200'),
('textbox', 'ipasearchtimelimit','3'),
('textbox', 'ipasearchrecordslimit', '200'),
('textbox', 'ipasearchtimelimit', '3'),
],
}
DATA2 = {
'mod': [
('textbox', 'ipasearchrecordslimit','100'),
('textbox', 'ipasearchtimelimit','2'),
('textbox', 'ipasearchrecordslimit', '100'),
('textbox', 'ipasearchtimelimit', '2'),
],
}
class test_config(UI_driver):
def test_mod(self):

View File

@ -40,8 +40,8 @@ DATA = {
],
}
class test_delegation(UI_driver):
class test_delegation(UI_driver):
def test_crud(self):
"""

View File

@ -40,7 +40,7 @@ ZONE_DATA = {
('checkbox', 'force', ''),
],
'mod': [
('checkbox', 'idnsallowsyncptr',''),
('checkbox', 'idnsallowsyncptr', ''),
],
}
@ -62,10 +62,11 @@ RECORD_MOD_DATA = {
CONFIG_MOD_DATA = {
'mod': [
('checkbox', 'idnsallowsyncptr',''),
('checkbox', 'idnsallowsyncptr', ''),
],
}
class test_dns(UI_driver):
def __init__(self, *args, **kwargs):
@ -82,7 +83,7 @@ class test_dns(UI_driver):
# add and mod zone
self.basic_crud(ZONE_ENTITY, ZONE_DATA,
default_facet=ZONE_DEFAULT_FACET , delete=False)
default_facet=ZONE_DEFAULT_FACET, delete=False)
# add and mod record
self.navigate_to_record(ZONE_PKEY)
@ -97,7 +98,6 @@ class test_dns(UI_driver):
self.navigate_by_breadcrumb("DNS Zones")
self.delete_record(ZONE_PKEY)
def test_config_crud(self):
"""
Basic CRUD: dnsconfig

View File

@ -56,7 +56,7 @@ class test_group(UI_driver):
self.add_record(group.ENTITY, group.DATA, navigate=False)
self.navigate_to_record(group.PKEY)
self.switch_to_facet('details')
self.facet_button_click('refresh')# workaround for BUG: #3702
self.facet_button_click('refresh') # workaround for BUG: #3702
self.make_external_action()
self.delete_action()
@ -153,7 +153,6 @@ class test_group(UI_driver):
self.add_associations([group.PKEY], 'member_group')
self.add_associations([group.PKEY5], 'memberof_group')
self.add_record(netgroup.ENTITY, netgroup.DATA)
self.navigate_to_record(netgroup.PKEY)
self.add_table_associations('memberuser_group', [group.PKEY4])

View File

@ -51,12 +51,12 @@ class test_hbac(UI_driver):
self.navigate_to_record(hbac.RULE_PKEY)
tables = [
['memberuser_user', ['admin'],],
['memberuser_group', ['editors'],],
['memberhost_host', [host_key],],
['memberhost_hostgroup', [hostgroup.PKEY],],
['memberservice_hbacsvc', ['ftp'],],
['memberservice_hbacsvcgroup', ['Sudo'],],
['memberuser_user', ['admin'], ],
['memberuser_group', ['editors'], ],
['memberhost_host', [host_key], ],
['memberhost_hostgroup', [hostgroup.PKEY], ],
['memberservice_hbacsvc', ['ftp'], ],
['memberservice_hbacsvcgroup', ['Sudo'], ],
]
categories = [
@ -100,7 +100,7 @@ class test_hbac(UI_driver):
host_key = self.config.get('ipa_server').strip()
self.navigate_to_entity('hbactest', 'user')
self.assert_facet('hbactest', 'user')
self.assert_facet('hbactest', 'user')
self.select_record('admin')
self.button_click('next')
@ -108,52 +108,52 @@ class test_hbac(UI_driver):
self.assert_facet('hbactest', 'targethost')
self.select_record(host_key)
self.button_click('prev')
self.assert_facet('hbactest', 'user')
self.assert_facet('hbactest', 'user')
self.switch_to_facet('targethost')
self.button_click('next')
self.wait_for_request(n=2)
self.assert_facet('hbactest', 'service')
self.assert_facet('hbactest', 'service')
self.select_record('ftp')
self.button_click('prev')
self.assert_facet('hbactest', 'targethost')
self.assert_facet('hbactest', 'targethost')
self.switch_to_facet('service')
self.button_click('next')
self.wait_for_request(n=2)
self.assert_facet('hbactest', 'rules')
self.assert_facet('hbactest', 'rules')
self.select_record('allow_all')
self.button_click('prev')
self.assert_facet('hbactest', 'service')
self.assert_facet('hbactest', 'service')
self.switch_to_facet('rules')
self.button_click('next')
self.wait_for_request(n=2)
self.assert_facet('hbactest', 'run_test')
self.assert_facet('hbactest', 'run_test')
self.button_click('run_test')
self.wait_for_request(n=2)
self.assert_text("div.hbac-test-result-panel p", 'Access Granted'.upper())
self.button_click('prev')
self.assert_facet('hbactest', 'rules')
self.assert_facet('hbactest', 'rules')
self.switch_to_facet('run_test')
self.button_click('new_test')
self.assert_facet('hbactest', 'user')
self.assert_facet('hbactest', 'user')
# test pre-run validation and navigation to related facet
self.switch_to_facet('run_test')
self.button_click('run_test')
self.assert_dialog('message_dialog')
self.click_on_link('User name')
self.assert_facet('hbactest', 'user')
self.assert_facet('hbactest', 'user')
self.switch_to_facet('run_test')
self.button_click('run_test')
self.assert_dialog('message_dialog')
self.click_on_link('Target host')
self.assert_facet('hbactest', 'targethost')
self.assert_facet('hbactest', 'targethost')
self.switch_to_facet('run_test')
self.button_click('run_test')
self.assert_dialog('message_dialog')
self.click_on_link('Service')
self.assert_facet('hbactest', 'service')
self.assert_facet('hbactest', 'service')

View File

@ -30,6 +30,7 @@ import ipatests.test_webui.data_sudo as sudo
ENTITY = 'host'
class host_tasks(UI_driver):
def __init__(self, *args, **kwargs):
@ -39,7 +40,7 @@ class host_tasks(UI_driver):
def prep_data(self):
host = 'itest'
domain = self.config.get('ipa_domain')
domain = self.config.get('ipa_domain')
ip = self.get_ip()
self.data = self.get_data(host, domain, ip)
self.pkey = self.data['pkey']
@ -47,7 +48,7 @@ class host_tasks(UI_driver):
def prep_data2(self):
host = 'itest2'
domain = self.config.get('ipa_domain')
domain = self.config.get('ipa_domain')
self.data2 = self.get_data(host, domain)
self.pkey2 = self.data2['pkey']
return self.data2
@ -75,7 +76,7 @@ class host_tasks(UI_driver):
'pkey': '%s.%s' % (host, domain),
'add': add_data,
'mod': [
('textarea', 'description','Desc'),
('textarea', 'description', 'Desc'),
],
'del': del_data,
}
@ -91,7 +92,7 @@ class host_tasks(UI_driver):
self.skip('FreeIPA Server IP address not configured')
ip = ip.split('.')
last = int(ip.pop())
ip.append(str(last+1))
ip.append(str(last + 1))
return '.'.join(ip)
def load_csr(self, path):
@ -139,7 +140,7 @@ class test_host(host_tasks):
self.action_panel_action(panel, 'request_cert')
self.fill_text('textarea.certificate', csr)
self.dialog_button_click('issue')
self.wait_for_request(n=2,d=0.5)
self.wait_for_request(n=2, d=0.5)
self.assert_visible("div[name='certificate-valid']")
# cert view

View File

@ -29,6 +29,7 @@ import ipatests.test_webui.data_hbac as hbac
import ipatests.test_webui.test_rbac as rbac
import ipatests.test_webui.data_sudo as sudo
class test_hostgroup(UI_driver):
def test_crud(self):
@ -111,7 +112,6 @@ class test_hostgroup(UI_driver):
self.add_associations([hostgroup.PKEY], 'member_hostgroup')
self.add_associations([hostgroup.PKEY5], 'memberof_hostgroup')
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
self.navigate_to_record(hbac.RULE_PKEY)
self.add_table_associations('memberhost_hostgroup', [hostgroup.PKEY4])

View File

@ -27,18 +27,19 @@ ENTITY = 'krbtpolicy'
DATA = {
'mod': [
('textbox', 'krbmaxrenewableage','599000'),
('textbox', 'krbmaxticketlife','79800'),
('textbox', 'krbmaxrenewableage', '599000'),
('textbox', 'krbmaxticketlife', '79800'),
],
}
DATA2 = {
'mod': [
('textbox', 'krbmaxrenewableage','604800'),
('textbox', 'krbmaxticketlife','86400'),
('textbox', 'krbmaxrenewableage', '604800'),
('textbox', 'krbmaxticketlife', '86400'),
],
}
class test_krbtpolicy(UI_driver):
def test_mod(self):

View File

@ -60,6 +60,7 @@ ENTITIES = [
# TODO: add conditional
]
class test_navigation(UI_driver):
def test_url_navigation(self):
@ -72,9 +73,9 @@ class test_navigation(UI_driver):
unsupported = []
if not self.has_dns():
unsupported.extend([
'dnszone',
'dnsconfig',
])
'dnszone',
'dnsconfig',
])
if not self.has_ca():
unsupported.append('cert')
@ -139,7 +140,6 @@ class test_navigation(UI_driver):
self.navigate_by_menu('ipaserver/trusts/trustconfig', False)
self.navigate_by_menu('ipaserver/config', False)
def assert_e_url(self, url, e):
"""
Assert correct url for entity

View File

@ -59,10 +59,10 @@ class test_netgroup(UI_driver):
self.navigate_to_record(netgroup.PKEY, entity=netgroup.ENTITY)
tables = [
['memberuser_user', [user.PKEY, user.PKEY2],],
['memberuser_group', [group.PKEY, group.PKEY2],],
['memberhost_host', [host.pkey, host.pkey2],],
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2],],
['memberuser_user', [user.PKEY, user.PKEY2], ],
['memberuser_group', [group.PKEY, group.PKEY2], ],
['memberhost_host', [host.pkey, host.pkey2], ],
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2], ],
]
categories = [

View File

@ -31,17 +31,18 @@ DATA = {
('textbox', 'cospriority', '364'),
],
'mod': [
('textbox', 'krbmaxpwdlife','3000'),
('textbox', 'krbminpwdlife','1'),
('textbox', 'krbpwdhistorylength','0'),
('textbox', 'krbpwdmindiffchars','2'),
('textbox', 'krbpwdminlength','2'),
('textbox', 'krbpwdmaxfailure','15'),
('textbox', 'krbpwdfailurecountinterval','5'),
('textbox', 'krbpwdlockoutduration','3600'),
('textbox', 'krbmaxpwdlife', '3000'),
('textbox', 'krbminpwdlife', '1'),
('textbox', 'krbpwdhistorylength', '0'),
('textbox', 'krbpwdmindiffchars', '2'),
('textbox', 'krbpwdminlength', '2'),
('textbox', 'krbpwdmaxfailure', '15'),
('textbox', 'krbpwdfailurecountinterval', '5'),
('textbox', 'krbpwdlockoutduration', '3600'),
],
}
class test_pwpolicy(UI_driver):
def test_crud(self):

View File

@ -26,6 +26,7 @@ from ipatests.test_webui.ui_driver import UI_driver
ENTITY = 'idrange'
PKEY = 'itest-range'
class test_range(UI_driver):
def get_shifts(self, idranges=None):

View File

@ -30,10 +30,10 @@ ROLE_DATA = {
'pkey': ROLE_PKEY,
'add': [
('textbox', 'cn', ROLE_PKEY),
('textarea', 'description','role desc'),
('textarea', 'description', 'role desc'),
],
'mod': [
('textarea', 'description','role desc mod'),
('textarea', 'description', 'role desc mod'),
],
}
@ -44,10 +44,10 @@ PRIVILEGE_DATA = {
'pkey': PRIVILEGE_PKEY,
'add': [
('textbox', 'cn', PRIVILEGE_PKEY),
('textarea', 'description','privilege desc'),
('textarea', 'description', 'privilege desc'),
],
'mod': [
('textarea', 'description','privilege desc mod'),
('textarea', 'description', 'privilege desc mod'),
],
}
@ -61,10 +61,11 @@ PERMISSION_DATA = {
('textbox', 'filter', 'cn=user'),
],
'mod': [
('textbox', 'filter','cn=user2'),
('textbox', 'filter', 'cn=user2'),
],
}
class test_rbac(UI_driver):
def test_crud(self):
@ -73,11 +74,11 @@ class test_rbac(UI_driver):
"""
self.init_app()
self.basic_crud(ROLE_ENTITY, ROLE_DATA,
default_facet=ROLE_DEF_FACET
)
default_facet=ROLE_DEF_FACET
)
self.basic_crud(PRIVILEGE_ENTITY, PRIVILEGE_DATA,
default_facet=PRIVILEGE_DEF_FACET
)
default_facet=PRIVILEGE_DEF_FACET
)
self.basic_crud(PERMISSION_ENTITY, PERMISSION_DATA)

View File

@ -25,6 +25,7 @@ from ipatests.test_webui.ui_driver import UI_driver
ENTITY = 'realmdomains'
class test_realmdomains(UI_driver):
def test_read(self):

View File

@ -37,8 +37,8 @@ DATA = {
],
}
class test_selfservice(UI_driver):
class test_selfservice(UI_driver):
def test_crud(self):
"""

View File

@ -28,18 +28,19 @@ import ipatests.test_webui.data_hostgroup as hostgroup
from ipatests.test_webui.test_host import host_tasks, ENTITY as HOST_ENTITY
ENTITY = 'selinuxusermap'
PKEY='itest-selinuxusermap'
PKEY = 'itest-selinuxusermap'
DATA = {
'pkey': PKEY,
'add': [
('textbox', 'cn', PKEY),
('textbox', 'ipaselinuxuser','user_u:s0'),
('textbox', 'ipaselinuxuser', 'user_u:s0'),
],
'mod': [
('textarea', 'description','itest-selinuxusermap desc'),
('textarea', 'description', 'itest-selinuxusermap desc'),
],
}
class test_selinuxusermap(UI_driver):
def test_crud(self):
@ -69,10 +70,10 @@ class test_selinuxusermap(UI_driver):
self.navigate_to_record(PKEY)
tables = [
['memberuser_user', [user.PKEY, user.PKEY2],],
['memberuser_group', [group.PKEY, group.PKEY2],],
['memberhost_host', [host.pkey, host.pkey2],],
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2],],
['memberuser_user', [user.PKEY, user.PKEY2], ],
['memberuser_group', [group.PKEY, group.PKEY2], ],
['memberhost_host', [host.pkey, host.pkey2], ],
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2], ],
]
categories = [

View File

@ -25,6 +25,7 @@ from ipatests.test_webui.ui_driver import UI_driver
ENTITY = 'service'
class sevice_tasks(UI_driver):
def prep_data(self):
@ -40,7 +41,7 @@ class sevice_tasks(UI_driver):
('combobox', 'host', host)
],
'mod': [
('checkbox', 'ipakrbokasdelegate',''),
('checkbox', 'ipakrbokasdelegate', ''),
],
}
@ -93,7 +94,7 @@ class test_service(sevice_tasks):
self.action_panel_action(panel, 'request_cert')
self.fill_text('textarea.certificate', csr)
self.dialog_button_click('issue')
self.wait_for_request(n=2,d=0.5)
self.wait_for_request(n=2, d=0.5)
self.assert_visible("div[name='certificate-valid']")
# cert view

View File

@ -29,6 +29,7 @@ import ipatests.test_webui.data_group as group
import ipatests.test_webui.data_hostgroup as hostgroup
from ipatests.test_webui.test_host import host_tasks, ENTITY as HOST_ENTITY
class test_sudo(UI_driver):
def test_crud(self):
@ -72,17 +73,17 @@ class test_sudo(UI_driver):
self.navigate_to_record(sudo.RULE_PKEY, entity=sudo.RULE_ENTITY)
tables = [
['memberuser_user', [user.PKEY, user.PKEY2],],
['memberuser_group', [group.PKEY, group.PKEY2],],
['memberhost_host', [host.pkey, host.pkey2],],
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2],],
['memberallowcmd_sudocmd', [sudo.CMD_PKEY, sudo.CMD_PKEY2],],
['memberallowcmd_sudocmdgroup', [sudo.CMD_GROUP_PKEY, sudo.CMD_GROUP_PKEY2],],
['memberdenycmd_sudocmd', [sudo.CMD_PKEY, sudo.CMD_PKEY2],],
['memberdenycmd_sudocmdgroup', [sudo.CMD_GROUP_PKEY, sudo.CMD_GROUP_PKEY2],],
['ipasudorunas_user', ['admin'],],
['ipasudorunas_group', ['editors', 'admins'],],
['ipasudorunasgroup_group', ['editors', 'admins'],],
['memberuser_user', [user.PKEY, user.PKEY2], ],
['memberuser_group', [group.PKEY, group.PKEY2], ],
['memberhost_host', [host.pkey, host.pkey2], ],
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2], ],
['memberallowcmd_sudocmd', [sudo.CMD_PKEY, sudo.CMD_PKEY2], ],
['memberallowcmd_sudocmdgroup', [sudo.CMD_GROUP_PKEY, sudo.CMD_GROUP_PKEY2], ],
['memberdenycmd_sudocmd', [sudo.CMD_PKEY, sudo.CMD_PKEY2], ],
['memberdenycmd_sudocmdgroup', [sudo.CMD_GROUP_PKEY, sudo.CMD_GROUP_PKEY2], ],
['ipasudorunas_user', ['admin'], ],
['ipasudorunas_group', ['editors', 'admins'], ],
['ipasudorunasgroup_group', ['editors', 'admins'], ],
]
categories = [

View File

@ -29,6 +29,7 @@ import ipatests.test_webui.data_hbac as hbac
import ipatests.test_webui.test_rbac as rbac
import ipatests.test_webui.data_sudo as sudo
class test_user(UI_driver):
def test_crud(self):
@ -90,7 +91,7 @@ class test_user(UI_driver):
self.add_record(group.ENTITY, group.DATA2)
self.navigate_to_record(group.PKEY2)
self.add_associations([group.PKEY],facet='member_group')
self.add_associations([group.PKEY], facet='member_group')
self.add_record(netgroup.ENTITY, netgroup.DATA)
self.navigate_to_record(netgroup.PKEY)
@ -128,7 +129,6 @@ class test_user(UI_driver):
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
def test_actions(self):
"""
Test user actions
@ -144,8 +144,8 @@ class test_user(UI_driver):
# reset password
pwd = self.config.get('ipa_password')
fields = [
('password' ,'password1', pwd),
('password' ,'password2', pwd),
('password', 'password1', pwd),
('password', 'password2', pwd),
]
self.action_panel_action('account_actions', 'reset_password')
self.assert_dialog()

View File

@ -75,6 +75,7 @@ DEFAULT_BROWSER = 'firefox'
DEFAULT_PORT = 4444
DEFAULT_TYPE = 'local'
class UI_driver(object):
"""
Base class for all UI integration tests
@ -109,14 +110,14 @@ class UI_driver(object):
except yaml.YAMLError, e:
raise nose.SkipTest("Invalid Web UI config.\n%s" % e)
except IOError, e:
raise nose.SkipTest("Can't load Web UI test config: %s" %e)
raise nose.SkipTest("Can't load Web UI test config: %s" % e)
else:
self.config = {}
c = self.config
# override with environmental variables
for k,v in ENV_MAP.iteritems():
for k, v in ENV_MAP.iteritems():
val = os.environ.get(k)
if val is not None:
c[v] = val
@ -129,7 +130,6 @@ class UI_driver(object):
if 'type' not in c:
c['type'] = DEFAULT_TYPE
def setUp(self):
"""
Test setup
@ -288,7 +288,6 @@ class UI_driver(object):
"""
return "contains(concat(' ',normalize-space(@%s), ' '),' %s ')" % (attr, val)
def init_app(self):
"""
Load and login
@ -346,7 +345,7 @@ class UI_driver(object):
def navigate_to_entity(self, entity, facet=None):
self.driver.get(self.get_url(entity, facet))
self.wait_for_request(n=3,d=0.4)
self.wait_for_request(n=3, d=0.4)
def navigate_by_menu(self, item, complete=True):
"""
@ -432,11 +431,13 @@ class UI_driver(object):
# get facet title
el = self.find(".facet-header h3 *:first-child", By.CSS_SELECTOR, facet)
if el: info["title"] = el.text
if el:
info["title"] = el.text
# get facet pkey
el = self.find(".facet-header h3 span.facet-pkey", By.CSS_SELECTOR, facet)
if el: info["pkey"] = el.text
if el:
info["pkey"] = el.text
return info
@ -466,7 +467,7 @@ class UI_driver(object):
"""
Get last opened error dialog or None.
"""
s = "div[role=dialog] div[data-name='%s']" % dialog_name
s = "div[role=dialog] div[data-name='%s']" % dialog_name
dialogs = self.find(s, By.CSS_SELECTOR, all=True)
dialog = None
if dialogs:
@ -656,7 +657,7 @@ class UI_driver(object):
for i in inputs:
val = i.get_attribute('value')
n = i.get_attribute('name')
if val == value:
if val == value:
s = "input[name='%s'] ~ a[name=remove]" % n
link = self.find(s, By.CSS_SELECTOR, w, strict=True)
link.click()
@ -677,14 +678,13 @@ class UI_driver(object):
else:
self.del_multivalued(name, value, parent)
def check_option(self, name, value=None, parent=None):
"""
Find checkbox or radio with name which matches ^NAME\d$
"""
if not parent:
parent = self.get_form()
s = "//input[@type='checkbox' or 'radio'][contains(@name, '%s')]" % name
s = "//input[@type='checkbox' or 'radio'][contains(@name, '%s')]" % name
if value is not None:
s += "[@value='%s']" % value
opts = self.find(s, "xpath", parent, all=True)
@ -826,7 +826,7 @@ class UI_driver(object):
s = "table"
if name:
s += "[name='%s']" % name
s +='.search-table'
s += '.search-table'
return s
def select_record(self, pkey, parent=None, table_name=None):
@ -901,7 +901,6 @@ class UI_driver(object):
self.wait_for_request(n=2)
self.wait()
def delete(self, entity, data_list, facet='search', navigate=True):
"""
Delete entity records:
@ -999,7 +998,6 @@ class UI_driver(object):
assert valid, "Values don't match. Expected: '%s', Got: '%s'" % (expected, actual)
def find_record(self, entity, data, facet='search', dummy='XXXXXXX'):
"""
Test search functionality of search facet.
@ -1011,7 +1009,6 @@ class UI_driver(object):
self.assert_facet(entity, facet)
facet = self.get_facet()
search_field_s = '.search-filter input[name=filter]'
key = data.get('pkey')
@ -1081,7 +1078,6 @@ class UI_driver(object):
self.dialog_button_click('ok')
self.wait_for_request()
# check for error
self.assert_no_error_dialog()
self.wait_for_request()
@ -1119,10 +1115,10 @@ class UI_driver(object):
self.assert_facet_button_enabled(facet_btn, enabled=False)
def basic_crud(self, entity, data,
parent_entity = None,
details_facet = 'details',
search_facet = 'search',
default_facet = 'details',
parent_entity=None,
details_facet='details',
search_facet='search',
default_facet='details',
add_facet_btn='add',
add_dialog_btn='add',
add_dialog_name='add',
@ -1190,7 +1186,6 @@ class UI_driver(object):
if delete:
self.delete_record(pkey, data.get('del'))
def add_table_record(self, name, data, parent=None):
"""
Add record to dnsrecord table, association table and similar
@ -1364,7 +1359,6 @@ class UI_driver(object):
# add multiple at once and test table delete button
self.add_table_associations(table, keys, delete=True)
def skip(self, reason):
"""
Skip tests
@ -1401,7 +1395,6 @@ class UI_driver(object):
dialogs = self.get_dialogs(name)
assert len(dialogs) == 1, 'No or more than one dialog opened'
def assert_no_error_dialog(self):
"""
Assert that no error dialog is opened
@ -1447,7 +1440,6 @@ class UI_driver(object):
s = "table[name='%s'] " % table_name
self.assert_button_enabled(name, s, enabled)
def assert_facet(self, entity, facet=None):
"""
Assert that current facet is correct
@ -1485,7 +1477,6 @@ class UI_driver(object):
else:
assert visible, "Element not visible: %s" % selector
def assert_record(self, pkey, parent=None, table_name=None, negative=False):
"""
Assert that record is in current search table