ui_tests: make associations cancelable

Adjust associations functions to simulate "cancel"
action.

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Michal Reznik 2018-03-13 19:07:20 +01:00 committed by Christian Heimes
parent 18e8c964f5
commit 553183944a

View File

@ -1415,7 +1415,8 @@ class UI_driver(object):
self.wait_for_request()
def prepare_associations(
self, pkeys, facet=None, facet_btn='add', member_pkeys=None):
self, pkeys, facet=None, facet_btn='add', member_pkeys=None,
confirm_btn='add'):
"""
Helper function for add_associations and delete_associations
"""
@ -1430,7 +1431,7 @@ class UI_driver(object):
self.select_record(key, table_name='available')
self.button_click('add')
self.dialog_button_click('add')
self.dialog_button_click(confirm_btn)
self.wait_for_request()
if member_pkeys:
@ -1442,12 +1443,16 @@ class UI_driver(object):
def add_associations(
self, pkeys, facet=None, delete=False, facet_btn='add',
member_pkeys=None):
member_pkeys=None, confirm_btn='add'):
"""
Add associations
"""
check_pkeys = self.prepare_associations(
pkeys, facet, facet_btn, member_pkeys)
pkeys, facet, facet_btn, member_pkeys, confirm_btn=confirm_btn)
# we need to return if we want to "cancel" to avoid assert record fail
if confirm_btn == 'cancel':
return
for key in check_pkeys:
self.assert_record(key)