UI tests for "ID Range": check adding range with overlapping of existing local range

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

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Serhii Tsymbaliuk 2018-09-26 09:12:52 +02:00
parent b180991aca
commit dde4d19f7b
2 changed files with 43 additions and 6 deletions

View File

@ -31,6 +31,16 @@ TRUSTED_ID_RANGE = 'ipa-ad-trust'
class range_tasks(UI_driver):
BASE_RANGE_OVERLAPS_ERROR = (
'Constraint violation: '
'New base range overlaps with existing base range.'
)
PRIMARY_RID_RANGE_OVERLAPS_ERROR = (
'Constraint violation: '
'New primary rid range overlaps with existing primary rid range.'
)
def get_shifts(self):
result = self.execute_api_from_ui('idrange_find', [], {})
idranges = result['result']['result']

View File

@ -171,9 +171,38 @@ class test_range(range_tasks):
dialog = self.get_last_error_dialog()
try:
assert ('Constraint violation: '
'New base range overlaps with existing base range.'
in dialog.text)
assert self.BASE_RANGE_OVERLAPS_ERROR in dialog.text
finally:
self.delete_record(pkey)
@screenshot
def test_add_range_overlaps_with_existing(self):
"""
Test creating ID Range with overlapping of existing range
"""
self.navigate_to_entity(ENTITY)
for range_type in self.range_types:
pkey = 'itest-range'
pkey_overlaps = 'itest-range-overlaps'
form_data = self.get_add_form_data(pkey)
data = self.get_data(pkey, form_data=form_data)
form_data_overlaps = self.get_add_form_data(
pkey_overlaps,
base_id=form_data.base_id + form_data.size - 1,
range_type=range_type
)
data_overlaps = self.get_data(form_data=form_data_overlaps)
self.add_record(ENTITY, data, navigate=False)
self.add_record(ENTITY, data_overlaps, navigate=False,
negative=True, pre_delete=False)
dialog = self.get_last_error_dialog()
try:
assert self.BASE_RANGE_OVERLAPS_ERROR in dialog.text
finally:
self.delete_record(pkey)
@ -197,9 +226,7 @@ class test_range(range_tasks):
dialog = self.get_last_error_dialog()
try:
assert ('Constraint violation: '
'New primary rid range overlaps with existing primary rid range.'
in dialog.text)
assert self.PRIMARY_RID_RANGE_OVERLAPS_ERROR in dialog.text
finally:
self.delete_record(pkey)