2013-05-24 06:48:53 -05:00
|
|
|
# Authors:
|
|
|
|
# Petr Vobornik <pvoborni@redhat.com>
|
|
|
|
#
|
|
|
|
# Copyright (C) 2013 Red Hat
|
|
|
|
# see file 'COPYING' for use and warranty information
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
"""
|
|
|
|
Basic ui tests
|
|
|
|
"""
|
|
|
|
|
|
|
|
from ipatests.test_webui.ui_driver import UI_driver
|
2014-04-29 02:16:24 -05:00
|
|
|
from ipatests.test_webui.ui_driver import screenshot
|
2015-04-24 07:39:48 -05:00
|
|
|
import pytest
|
2013-05-24 06:48:53 -05:00
|
|
|
|
|
|
|
|
|
|
|
ENTITIES = [
|
|
|
|
'group',
|
|
|
|
'user',
|
|
|
|
'host',
|
|
|
|
'hostgroup',
|
|
|
|
'netgroup',
|
|
|
|
'service',
|
|
|
|
'dnszone',
|
2014-06-19 09:26:23 -05:00
|
|
|
'dnsforwardzone',
|
2013-05-24 06:48:53 -05:00
|
|
|
# TODO: dnsrecord
|
|
|
|
'dnsconfig',
|
|
|
|
'cert',
|
2014-07-02 08:09:22 -05:00
|
|
|
'otptoken',
|
|
|
|
'radiusproxy',
|
2013-05-24 06:48:53 -05:00
|
|
|
'realmdomains',
|
|
|
|
'hbacrule',
|
|
|
|
'hbacsvc',
|
|
|
|
'hbacsvcgroup',
|
|
|
|
'hbactest',
|
|
|
|
'sudorule',
|
|
|
|
'sudocmd',
|
|
|
|
'sudocmdgroup',
|
|
|
|
'automountlocation',
|
|
|
|
# TODO: add nested maps, keys
|
|
|
|
'pwpolicy',
|
|
|
|
'krbtpolicy',
|
|
|
|
'selinuxusermap',
|
|
|
|
'automember',
|
|
|
|
# TODO: add different types
|
|
|
|
'role',
|
|
|
|
'privilege',
|
|
|
|
'permission',
|
|
|
|
'selfservice',
|
|
|
|
'delegation',
|
|
|
|
'idrange',
|
|
|
|
'config',
|
|
|
|
# TODO: add conditional
|
|
|
|
]
|
|
|
|
|
2013-07-24 06:24:02 -05:00
|
|
|
|
2015-04-24 07:39:48 -05:00
|
|
|
@pytest.mark.tier1
|
2013-05-24 06:48:53 -05:00
|
|
|
class test_navigation(UI_driver):
|
|
|
|
|
2014-04-29 02:16:24 -05:00
|
|
|
@screenshot
|
2013-05-24 06:48:53 -05:00
|
|
|
def test_url_navigation(self):
|
|
|
|
"""
|
|
|
|
Navigation test: direct url change
|
|
|
|
"""
|
|
|
|
|
|
|
|
self.init_app()
|
|
|
|
|
|
|
|
unsupported = []
|
|
|
|
if not self.has_dns():
|
|
|
|
unsupported.extend([
|
2013-07-24 06:24:02 -05:00
|
|
|
'dnszone',
|
2014-07-02 08:09:22 -05:00
|
|
|
'dnsforwardzone',
|
2013-07-24 06:24:02 -05:00
|
|
|
'dnsconfig',
|
|
|
|
])
|
2013-05-24 06:48:53 -05:00
|
|
|
if not self.has_ca():
|
|
|
|
unsupported.append('cert')
|
|
|
|
|
|
|
|
entities = [e for e in ENTITIES if e not in unsupported]
|
|
|
|
|
|
|
|
for e in entities:
|
|
|
|
self.wait_for_request()
|
|
|
|
self.navigate_to_entity(e)
|
|
|
|
self.assert_facet(e)
|
|
|
|
url = self.get_url(e)
|
|
|
|
self.assert_e_url(url, e)
|
|
|
|
|
2014-04-29 02:16:24 -05:00
|
|
|
@screenshot
|
2013-05-24 06:48:53 -05:00
|
|
|
def test_menu_navigation(self):
|
|
|
|
"""
|
|
|
|
Navigation test: menu items
|
|
|
|
"""
|
|
|
|
|
|
|
|
self.init_app()
|
|
|
|
|
2014-07-02 08:09:22 -05:00
|
|
|
# Identity
|
2013-05-24 06:48:53 -05:00
|
|
|
# don't start by users (default)
|
2018-02-08 12:04:46 -06:00
|
|
|
self.navigate_by_menu('identity/group_search', False)
|
|
|
|
# navigate on the side bar
|
|
|
|
self.click_on_link('User Groups')
|
|
|
|
self.click_on_link('Host Groups')
|
2016-07-20 09:14:16 -05:00
|
|
|
self.navigate_by_menu('identity/user_search', False)
|
2013-05-24 06:48:53 -05:00
|
|
|
self.navigate_by_menu('identity/host', False)
|
|
|
|
self.navigate_by_menu('identity/service', False)
|
2018-02-08 12:04:46 -06:00
|
|
|
self.navigate_by_menu('identity/idview', False)
|
2014-07-02 08:09:22 -05:00
|
|
|
self.navigate_by_menu('identity/automember', False)
|
|
|
|
self.navigate_by_menu('identity/automember/amhostgroup')
|
|
|
|
self.navigate_by_menu('identity/automember/amgroup')
|
|
|
|
|
|
|
|
# Policy
|
2013-05-24 06:48:53 -05:00
|
|
|
self.navigate_by_menu('policy')
|
|
|
|
self.navigate_by_menu('policy/hbac', False)
|
|
|
|
self.navigate_by_menu('policy/hbac/hbacsvc', False)
|
2013-10-11 10:19:40 -05:00
|
|
|
self.navigate_by_menu('policy/hbac/hbacrule')
|
|
|
|
self.navigate_by_menu('policy/hbac/hbacsvcgroup')
|
|
|
|
self.navigate_by_menu('policy/hbac/hbactest')
|
2013-05-24 06:48:53 -05:00
|
|
|
self.navigate_by_menu('policy/sudo', False)
|
|
|
|
self.navigate_by_menu('policy/sudo/sudorule', False)
|
2013-10-11 10:19:40 -05:00
|
|
|
self.navigate_by_menu('policy/sudo/sudocmd')
|
|
|
|
self.navigate_by_menu('policy/sudo/sudocmdgroup')
|
2014-07-02 08:09:22 -05:00
|
|
|
self.navigate_by_menu('policy/selinuxusermap', False)
|
2013-05-24 06:48:53 -05:00
|
|
|
self.navigate_by_menu('policy/pwpolicy', False)
|
|
|
|
self.navigate_by_menu('policy/krbtpolicy', False)
|
2014-07-02 08:09:22 -05:00
|
|
|
|
|
|
|
# Authentication
|
|
|
|
self.navigate_by_menu('authentication')
|
|
|
|
self.navigate_by_menu('authentication/radiusproxy', False)
|
|
|
|
self.navigate_by_menu('authentication/otptoken', False)
|
|
|
|
if self.has_ca():
|
2016-07-20 09:14:16 -05:00
|
|
|
self.navigate_by_menu('authentication/cert_search', False)
|
2014-07-02 08:09:22 -05:00
|
|
|
else:
|
2016-07-20 09:14:16 -05:00
|
|
|
self.assert_menu_item('authentication/cert_search', False)
|
2014-07-02 08:09:22 -05:00
|
|
|
|
|
|
|
# Network Services
|
|
|
|
self.navigate_by_menu('network_services')
|
|
|
|
self.navigate_by_menu('network_services/automount')
|
|
|
|
if self.has_dns():
|
|
|
|
self.navigate_by_menu('network_services/dns/dnsconfig', True)
|
|
|
|
self.navigate_by_menu('network_services/dns', False)
|
|
|
|
self.navigate_by_menu('network_services/dns/dnszone', False)
|
|
|
|
self.navigate_by_menu('network_services/dns/dnsforwardzone')
|
|
|
|
else:
|
|
|
|
self.assert_menu_item('network_services/dns', False)
|
|
|
|
|
|
|
|
# IPA Server
|
2013-05-24 06:48:53 -05:00
|
|
|
self.navigate_by_menu('ipaserver')
|
2014-07-02 08:09:22 -05:00
|
|
|
self.navigate_by_menu('ipaserver/rbac', False)
|
|
|
|
self.navigate_by_menu('ipaserver/rbac/privilege', False)
|
|
|
|
self.navigate_by_menu('ipaserver/rbac/role')
|
|
|
|
self.navigate_by_menu('ipaserver/rbac/permission')
|
|
|
|
self.navigate_by_menu('ipaserver/rbac/selfservice')
|
|
|
|
self.navigate_by_menu('ipaserver/rbac/delegation')
|
2013-05-24 06:48:53 -05:00
|
|
|
self.navigate_by_menu('ipaserver/idrange', False)
|
2014-07-02 08:09:22 -05:00
|
|
|
self.navigate_by_menu('ipaserver/realmdomains', False)
|
2013-05-24 06:48:53 -05:00
|
|
|
if self.has_trusts():
|
|
|
|
self.navigate_by_menu('ipaserver/trusts', False)
|
|
|
|
self.navigate_by_menu('ipaserver/trusts/trust', False)
|
2013-10-11 10:19:40 -05:00
|
|
|
self.navigate_by_menu('ipaserver/trusts/trustconfig')
|
2013-08-15 08:49:27 -05:00
|
|
|
else:
|
|
|
|
self.assert_menu_item('ipaserver/trusts', False)
|
2013-05-24 06:48:53 -05:00
|
|
|
self.navigate_by_menu('ipaserver/config', False)
|
|
|
|
|
2014-07-02 08:09:22 -05:00
|
|
|
|
2013-05-24 06:48:53 -05:00
|
|
|
def assert_e_url(self, url, e):
|
|
|
|
"""
|
|
|
|
Assert correct url for entity
|
|
|
|
"""
|
|
|
|
if not self.driver.current_url.startswith(url):
|
|
|
|
msg = 'Invalid url for: %s' % e
|
|
|
|
raise AssertionError(msg)
|