From 6ec5e5fec6bb2b1d8b556779a1309ed1295508b7 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Wed, 24 Jul 2013 13:24:02 +0200 Subject: 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 --- ipatests/test_webui/data_group.py | 22 ++++++++-------- ipatests/test_webui/data_hbac.py | 2 +- ipatests/test_webui/data_hostgroup.py | 22 ++++++++-------- ipatests/test_webui/data_netgroup.py | 2 +- ipatests/test_webui/data_sudo.py | 2 +- ipatests/test_webui/data_user.py | 10 ++++---- ipatests/test_webui/test_automember.py | 33 ++++++++---------------- ipatests/test_webui/test_automount.py | 33 ++++++++++++------------ ipatests/test_webui/test_cert.py | 2 +- ipatests/test_webui/test_config.py | 9 ++++--- ipatests/test_webui/test_delegation.py | 2 +- ipatests/test_webui/test_dns.py | 8 +++--- ipatests/test_webui/test_group.py | 3 +-- ipatests/test_webui/test_hbac.py | 36 +++++++++++++------------- ipatests/test_webui/test_host.py | 11 ++++---- ipatests/test_webui/test_hostgroup.py | 4 +-- ipatests/test_webui/test_krbtpolicy.py | 9 ++++--- ipatests/test_webui/test_navigation.py | 8 +++--- ipatests/test_webui/test_netgroup.py | 8 +++--- ipatests/test_webui/test_pwpolicy.py | 17 +++++++------ ipatests/test_webui/test_range.py | 1 + ipatests/test_webui/test_rbac.py | 19 +++++++------- ipatests/test_webui/test_realmdomains.py | 3 ++- ipatests/test_webui/test_selfservice.py | 2 +- ipatests/test_webui/test_selinuxusermap.py | 17 +++++++------ ipatests/test_webui/test_service.py | 5 ++-- ipatests/test_webui/test_sudo.py | 23 +++++++++-------- ipatests/test_webui/test_user.py | 8 +++--- ipatests/test_webui/ui_driver.py | 41 ++++++++++++------------------ 29 files changed, 176 insertions(+), 186 deletions(-) (limited to 'ipatests') diff --git a/ipatests/test_webui/data_group.py b/ipatests/test_webui/data_group.py index c933abee..2b32b2f3 100644 --- a/ipatests/test_webui/data_group.py +++ b/ipatests/test_webui/data_group.py @@ -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'), ] -} \ No newline at end of file +} diff --git a/ipatests/test_webui/data_hbac.py b/ipatests/test_webui/data_hbac.py index bc420fe0..9a5ee600 100644 --- a/ipatests/test_webui/data_hbac.py +++ b/ipatests/test_webui/data_hbac.py @@ -54,4 +54,4 @@ SVCGROUP_DATA = { 'mod': [ ('textarea', 'description', 'testhbaccvcgroup desc mod'), ], -} \ No newline at end of file +} diff --git a/ipatests/test_webui/data_hostgroup.py b/ipatests/test_webui/data_hostgroup.py index 811168cd..9b874042 100644 --- a/ipatests/test_webui/data_hostgroup.py +++ b/ipatests/test_webui/data_hostgroup.py @@ -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'), ], -} \ No newline at end of file +} diff --git a/ipatests/test_webui/data_netgroup.py b/ipatests/test_webui/data_netgroup.py index 41ed85b3..8484ba9e 100644 --- a/ipatests/test_webui/data_netgroup.py +++ b/ipatests/test_webui/data_netgroup.py @@ -40,4 +40,4 @@ DATA2 = { 'mod': [ ('textarea', 'description', 'test-netgroup2 desc modified'), ], -} \ No newline at end of file +} diff --git a/ipatests/test_webui/data_sudo.py b/ipatests/test_webui/data_sudo.py index e555bcf0..379016b5 100644 --- a/ipatests/test_webui/data_sudo.py +++ b/ipatests/test_webui/data_sudo.py @@ -79,4 +79,4 @@ CMDGROUP_DATA2 = { 'mod': [ ('textarea', 'description', 'itestsudocmdgroup2 desc mod'), ], -} \ No newline at end of file +} diff --git a/ipatests/test_webui/data_user.py b/ipatests/test_webui/data_user.py index 20ac3868..79a53898 100644 --- a/ipatests/test_webui/data_user.py +++ b/ipatests/test_webui/data_user.py @@ -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'), ], -} \ No newline at end of file +} diff --git a/ipatests/test_webui/test_automember.py b/ipatests/test_webui/test_automember.py index d48ecc93..f51e5d9b 100644 --- a/ipatests/test_webui/test_automember.py +++ b/ipatests/test_webui/test_automember.py @@ -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]) diff --git a/ipatests/test_webui/test_automount.py b/ipatests/test_webui/test_automount.py index 1f6f29b7..a11150ad 100644 --- a/ipatests/test_webui/test_automount.py +++ b/ipatests/test_webui/test_automount.py @@ -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) diff --git a/ipatests/test_webui/test_cert.py b/ipatests/test_webui/test_cert.py index a59f1269..dc56e6c6 100644 --- a/ipatests/test_webui/test_cert.py +++ b/ipatests/test_webui/test_cert.py @@ -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 diff --git a/ipatests/test_webui/test_config.py b/ipatests/test_webui/test_config.py index fb160e81..f7f568f5 100644 --- a/ipatests/test_webui/test_config.py +++ b/ipatests/test_webui/test_config.py @@ -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): diff --git a/ipatests/test_webui/test_delegation.py b/ipatests/test_webui/test_delegation.py index 0c59e858..2389b928 100644 --- a/ipatests/test_webui/test_delegation.py +++ b/ipatests/test_webui/test_delegation.py @@ -40,8 +40,8 @@ DATA = { ], } -class test_delegation(UI_driver): +class test_delegation(UI_driver): def test_crud(self): """ diff --git a/ipatests/test_webui/test_dns.py b/ipatests/test_webui/test_dns.py index 23a3a4b1..aeff77b8 100644 --- a/ipatests/test_webui/test_dns.py +++ b/ipatests/test_webui/test_dns.py @@ -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 diff --git a/ipatests/test_webui/test_group.py b/ipatests/test_webui/test_group.py index 645dba0a..fb5a8363 100644 --- a/ipatests/test_webui/test_group.py +++ b/ipatests/test_webui/test_group.py @@ -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]) diff --git a/ipatests/test_webui/test_hbac.py b/ipatests/test_webui/test_hbac.py index cfc28696..7b283e6a 100644 --- a/ipatests/test_webui/test_hbac.py +++ b/ipatests/test_webui/test_hbac.py @@ -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') diff --git a/ipatests/test_webui/test_host.py b/ipatests/test_webui/test_host.py index a3938fdb..962ffb17 100644 --- a/ipatests/test_webui/test_host.py +++ b/ipatests/test_webui/test_host.py @@ -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 diff --git a/ipatests/test_webui/test_hostgroup.py b/ipatests/test_webui/test_hostgroup.py index 6bd239f1..9ba61211 100644 --- a/ipatests/test_webui/test_hostgroup.py +++ b/ipatests/test_webui/test_hostgroup.py @@ -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]) @@ -138,4 +138,4 @@ class test_hostgroup(UI_driver): hostgroup.DATA3, hostgroup.DATA4, hostgroup.DATA5]) self.delete(HOST_ENTITY, [host.data2]) self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA]) - self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA]) \ No newline at end of file + self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA]) diff --git a/ipatests/test_webui/test_krbtpolicy.py b/ipatests/test_webui/test_krbtpolicy.py index d6db1302..e143a129 100644 --- a/ipatests/test_webui/test_krbtpolicy.py +++ b/ipatests/test_webui/test_krbtpolicy.py @@ -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): diff --git a/ipatests/test_webui/test_navigation.py b/ipatests/test_webui/test_navigation.py index 005cbfee..021495b4 100644 --- a/ipatests/test_webui/test_navigation.py +++ b/ipatests/test_webui/test_navigation.py @@ -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 diff --git a/ipatests/test_webui/test_netgroup.py b/ipatests/test_webui/test_netgroup.py index 31dfde67..0336639e 100644 --- a/ipatests/test_webui/test_netgroup.py +++ b/ipatests/test_webui/test_netgroup.py @@ -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 = [ diff --git a/ipatests/test_webui/test_pwpolicy.py b/ipatests/test_webui/test_pwpolicy.py index a319a29c..e6a9e872 100644 --- a/ipatests/test_webui/test_pwpolicy.py +++ b/ipatests/test_webui/test_pwpolicy.py @@ -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): diff --git a/ipatests/test_webui/test_range.py b/ipatests/test_webui/test_range.py index 93e3e789..0a7da7e4 100644 --- a/ipatests/test_webui/test_range.py +++ b/ipatests/test_webui/test_range.py @@ -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): diff --git a/ipatests/test_webui/test_rbac.py b/ipatests/test_webui/test_rbac.py index 8d8c1acb..e05453f8 100644 --- a/ipatests/test_webui/test_rbac.py +++ b/ipatests/test_webui/test_rbac.py @@ -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) diff --git a/ipatests/test_webui/test_realmdomains.py b/ipatests/test_webui/test_realmdomains.py index 7173e13b..7836f689 100644 --- a/ipatests/test_webui/test_realmdomains.py +++ b/ipatests/test_webui/test_realmdomains.py @@ -25,6 +25,7 @@ from ipatests.test_webui.ui_driver import UI_driver ENTITY = 'realmdomains' + class test_realmdomains(UI_driver): def test_read(self): @@ -45,4 +46,4 @@ class test_realmdomains(UI_driver): self.facet_button_click('update') self.dialog_button_click('force') self.wait_for_request() - self.wait_for_request() \ No newline at end of file + self.wait_for_request() diff --git a/ipatests/test_webui/test_selfservice.py b/ipatests/test_webui/test_selfservice.py index 5e7c4191..b1ee7f45 100644 --- a/ipatests/test_webui/test_selfservice.py +++ b/ipatests/test_webui/test_selfservice.py @@ -37,8 +37,8 @@ DATA = { ], } -class test_selfservice(UI_driver): +class test_selfservice(UI_driver): def test_crud(self): """ diff --git a/ipatests/test_webui/test_selinuxusermap.py b/ipatests/test_webui/test_selinuxusermap.py index 39700544..29b9479a 100644 --- a/ipatests/test_webui/test_selinuxusermap.py +++ b/ipatests/test_webui/test_selinuxusermap.py @@ -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 = [ @@ -101,4 +102,4 @@ class test_selinuxusermap(UI_driver): self.disable_action() self.enable_action() - self.delete_action(ENTITY, PKEY) \ No newline at end of file + self.delete_action(ENTITY, PKEY) diff --git a/ipatests/test_webui/test_service.py b/ipatests/test_webui/test_service.py index cd32cce3..81d638f1 100644 --- a/ipatests/test_webui/test_service.py +++ b/ipatests/test_webui/test_service.py @@ -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 diff --git a/ipatests/test_webui/test_sudo.py b/ipatests/test_webui/test_sudo.py index 3e7b448e..0fd7bcab 100644 --- a/ipatests/test_webui/test_sudo.py +++ b/ipatests/test_webui/test_sudo.py @@ -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 = [ diff --git a/ipatests/test_webui/test_user.py b/ipatests/test_webui/test_user.py index ec1d1951..a17ac27a 100644 --- a/ipatests/test_webui/test_user.py +++ b/ipatests/test_webui/test_user.py @@ -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() diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index 508418b6..66141d80 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -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 -- cgit