mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 00:31:56 -06:00
Web UI integration tests: CA-less
Test cases according to: http://www.freeipa.org/page/V3/CA-less_install https://fedorahosted.org/freeipa/ticket/3830
This commit is contained in:
parent
e61c2e3441
commit
8e8afe0519
@ -175,6 +175,29 @@ class test_host(host_tasks):
|
||||
self.navigate_to_entity(ENTITY, 'search')
|
||||
self.delete_record(self.pkey, self.data.get('del'))
|
||||
|
||||
def test_ca_less(self):
|
||||
"""
|
||||
Test host certificate actions in CA-less install
|
||||
http://www.freeipa.org/page/V3/CA-less_install
|
||||
"""
|
||||
if self.has_ca():
|
||||
self.skip('CA is installed')
|
||||
|
||||
self.init_app()
|
||||
self.add_record(ENTITY, self.data)
|
||||
self.navigate_to_record(self.pkey)
|
||||
|
||||
panel = 'cert_actions'
|
||||
self.assert_action_panel_action(panel, 'request_cert', visible=False)
|
||||
self.assert_action_panel_action(panel, 'revoke_cert', visible=False)
|
||||
self.assert_action_panel_action(panel, 'restore_cert', visible=False)
|
||||
|
||||
self.assert_action_panel_action(panel, 'view_cert', enabled=False)
|
||||
self.assert_action_panel_action(panel, 'get_cert', enabled=False)
|
||||
|
||||
self.navigate_by_breadcrumb('Hosts')
|
||||
self.delete_record(self.pkey, self.data.get('del'))
|
||||
|
||||
def test_associations(self):
|
||||
"""
|
||||
Host direct associations
|
||||
|
@ -106,8 +106,12 @@ class test_navigation(UI_driver):
|
||||
self.navigate_by_menu('identity/dns', False)
|
||||
self.navigate_by_menu('identity/dns/dnsconfig', False)
|
||||
self.navigate_by_menu('identity/dns/dnszone', False)
|
||||
else:
|
||||
self.assert_menu_item('identity/dns', False)
|
||||
if self.has_ca():
|
||||
self.navigate_by_menu('identity/cert', False)
|
||||
else:
|
||||
self.assert_menu_item('identity/cert', False)
|
||||
self.navigate_by_menu('identity/realmdomains', False)
|
||||
self.navigate_by_menu('policy')
|
||||
self.navigate_by_menu('policy/hbac', False)
|
||||
@ -138,6 +142,8 @@ class test_navigation(UI_driver):
|
||||
self.navigate_by_menu('ipaserver/trusts', False)
|
||||
self.navigate_by_menu('ipaserver/trusts/trust', False)
|
||||
self.navigate_by_menu('ipaserver/trusts/trustconfig', False)
|
||||
else:
|
||||
self.assert_menu_item('ipaserver/trusts', False)
|
||||
self.navigate_by_menu('ipaserver/config', False)
|
||||
|
||||
def assert_e_url(self, url, e):
|
||||
|
@ -128,3 +128,40 @@ class test_service(sevice_tasks):
|
||||
# cleanup
|
||||
self.navigate_to_entity(ENTITY, 'search')
|
||||
self.delete_record(pkey, data.get('del'))
|
||||
|
||||
def test_ca_less(self):
|
||||
"""
|
||||
Test service certificate actions in CA-less install
|
||||
http://www.freeipa.org/page/V3/CA-less_install
|
||||
"""
|
||||
if self.has_ca():
|
||||
self.skip('CA is installed')
|
||||
|
||||
self.init_app()
|
||||
|
||||
data = self.prep_data()
|
||||
pkey = data.get('pkey')
|
||||
|
||||
self.add_record(ENTITY, data)
|
||||
self.navigate_to_record(pkey)
|
||||
|
||||
panel = 'cert_actions'
|
||||
self.assert_action_panel_action(panel, 'request_cert', visible=False)
|
||||
self.assert_action_panel_action(panel, 'revoke_cert', visible=False)
|
||||
self.assert_action_panel_action(panel, 'restore_cert', visible=False)
|
||||
|
||||
self.assert_action_panel_action(panel, 'view_cert', enabled=False)
|
||||
self.assert_action_panel_action(panel, 'get_cert', enabled=False)
|
||||
|
||||
self.navigate_by_breadcrumb('Services')
|
||||
self.delete_record(pkey, data.get('del'))
|
||||
|
||||
# test HTTP, which should have cert set by default and so 'view' and 'get'
|
||||
# actions visible and enabled
|
||||
host = self.config.get('ipa_server')
|
||||
realm = self.config.get('ipa_realm')
|
||||
pkey = 'HTTP/%s@%s' % (host, realm)
|
||||
|
||||
self.navigate_to_record(pkey)
|
||||
self.assert_action_panel_action(panel, 'view_cert')
|
||||
self.assert_action_panel_action(panel, 'get_cert')
|
||||
|
@ -567,7 +567,7 @@ class UI_driver(object):
|
||||
|
||||
def _button_click(self, selector, parent, name=''):
|
||||
btn = self.find(selector, By.CSS_SELECTOR, parent, strict=True)
|
||||
disabled = 'ui-state-disabled' in btn.get_attribute("class").split(' ')
|
||||
disabled = 'ui-state-disabled' in btn.get_attribute("class").split()
|
||||
assert btn.is_displayed(), 'Button is not displayed: %s' % name
|
||||
assert not disabled, 'Invalid button state: disabled. Button: %s' % name
|
||||
btn.click()
|
||||
@ -1425,7 +1425,7 @@ class UI_driver(object):
|
||||
facet = self.get_facet()
|
||||
btn = self.find(s, By.CSS_SELECTOR, facet, strict=True)
|
||||
cls = 'action-button-disabled'
|
||||
has_cls = cls in btn.get_attribute("class").split(' ')
|
||||
has_cls = cls in btn.get_attribute("class").split()
|
||||
valid = enabled ^ has_cls
|
||||
assert btn.is_displayed(), 'Button is not displayed'
|
||||
assert valid, 'Button has incorrect enabled state.'
|
||||
@ -1510,7 +1510,7 @@ class UI_driver(object):
|
||||
"""
|
||||
Assert that element has certain class
|
||||
"""
|
||||
valid = cls in element.get_attribute('class').split(' ')
|
||||
valid = cls in element.get_attribute('class').split()
|
||||
if negative:
|
||||
assert not valid, "Element contains unwanted class: %s" % cls
|
||||
else:
|
||||
@ -1522,3 +1522,35 @@ class UI_driver(object):
|
||||
"""
|
||||
for table in tables:
|
||||
self.assert_table_button_enabled('add', table, enabled)
|
||||
|
||||
def assert_menu_item(self, path, present=True):
|
||||
"""
|
||||
Assert that menu link is not rendered or visible
|
||||
"""
|
||||
s = ".navigation a[href='#%s']" % path
|
||||
link = self.find(s, By.CSS_SELECTOR)
|
||||
is_present = link is not None and link.is_displayed()
|
||||
assert present == is_present, ('Invalid state of navigation item: %s. '
|
||||
'Presence expected: %s') % (path, str(present))
|
||||
|
||||
def assert_action_panel_action(self, panel_name, action, visible=True, enabled=True):
|
||||
"""
|
||||
Assert that action panel action is visible/hidden, and enabled/disabled
|
||||
|
||||
Enabled is checked only if action is visible.
|
||||
"""
|
||||
s = "div[data-name='%s'].action-panel" % panel_name
|
||||
s += " a[data-name='%s']" % action
|
||||
link = self.find(s, By.CSS_SELECTOR)
|
||||
|
||||
is_visible = link is not None and link.is_displayed()
|
||||
is_enabled = False
|
||||
if is_visible:
|
||||
is_enabled = 'disabled' not in link.get_attribute("class").split()
|
||||
|
||||
assert is_visible == visible, ('Invalid visibility of action button: %s. '
|
||||
'Expected: %s') % (action, str(visible))
|
||||
|
||||
if is_visible:
|
||||
assert is_enabled == enabled, ('Invalid enabled state of action button %s. '
|
||||
'Expected: %s') % (action, str(visible))
|
||||
|
Loading…
Reference in New Issue
Block a user