WebUI Tests: fixing test_range test case

As described in the commit [1] and ticket [2], it should not be possible to
change the range of a local IPA domain.

The basic_crud was changed to make it flexible to do not run the mod operation
if needed.

[1] 55feea500b
[2] https://pagure.io/freeipa/issue/4826

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Felipe Barreto 2018-02-08 16:07:49 -02:00 committed by Christian Heimes
parent 49a17e98b0
commit 12da43c54f
2 changed files with 37 additions and 2 deletions

View File

@ -40,7 +40,41 @@ class test_range(range_tasks):
""" """
self.init_app() self.init_app()
self.get_shifts() self.get_shifts()
self.basic_crud(ENTITY, self.get_data(PKEY)) self.basic_crud(ENTITY, self.get_data(PKEY), mod=False)
@screenshot
def test_mod(self):
"""
Test mod operating in a new range
"""
self.init_app()
self.navigate_to_entity(ENTITY)
self.get_shifts()
add = self.get_add_data(PKEY)
data = self.get_data(PKEY, add_data=add)
self.add_record(ENTITY, data, facet='search', navigate=False,
facet_btn='add', dialog_name='add',
dialog_btn='add')
self.navigate_to_record(PKEY)
# changes idrange and tries to save it
self.fill_fields(data['mod'], undo=True)
self.assert_facet_button_enabled('save')
self.facet_button_click('save')
self.wait_for_request(n=2)
# the user should not be able to change the ID allocation for
# IPA domain, as it's explained in https://pagure.io/freeipa/issue/4826
dialog = self.get_last_error_dialog()
assert ("can not be used to change ID allocation for local IPA domain"
in dialog.text)
self.dialog_button_click('cancel')
self.navigate_to_entity(ENTITY)
self.wait_for_request()
self.delete_record(PKEY)
@screenshot @screenshot
def test_types(self): def test_types(self):

View File

@ -1293,6 +1293,7 @@ class UI_driver(object):
update_btn='save', update_btn='save',
breadcrumb=None, breadcrumb=None,
navigate=True, navigate=True,
mod=True,
delete=True): delete=True):
""" """
Basic CRUD operation sequence. Basic CRUD operation sequence.
@ -1343,7 +1344,7 @@ class UI_driver(object):
self.validate_fields(data.get('add_v')) self.validate_fields(data.get('add_v'))
# 4. Mod values # 4. Mod values
if data.get('mod'): if mod and data.get('mod'):
self.mod_record(entity, data, details_facet, update_btn) self.mod_record(entity, data, details_facet, update_btn)
self.validate_fields(data.get('mod_v')) self.validate_fields(data.get('mod_v'))