Skip to content

Commit

Permalink
duplicate bookmark negative test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pondrejk committed Mar 1, 2024
1 parent e94158a commit a04d098
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/foreman/ui/test_bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:CaseImportance: High
"""
from airgun.exceptions import NoSuchElementException
from airgun.exceptions import DisabledWidgetError, NoSuchElementException
from fauxfactory import gen_string
import pytest

Expand Down Expand Up @@ -259,10 +259,15 @@ def test_negative_create_with_duplicate_name(session, ui_entity, module_target_s
existing_bookmark = session.bookmark.search(bookmark.name)[0]
assert existing_bookmark['Name'] == bookmark.name
ui_lib = getattr(session, ui_entity['name'].lower())
# this fails but does not raise UI error, BZ#1992652 closed wontfix
ui_lib.create_bookmark({'name': bookmark.name, 'query': query, 'public': True})
# assert there are no duplicate bookmarks
new_search = session.bookmark.search(bookmark.name)
assert len(new_search) == 1
# assert bookmark query wasn't overriden
assert new_search[0]['Search query'] == existing_bookmark['Search query']
# this fails but does not raise UI error in old style dialog, BZ#1992652 closed
# wontfix, but new style dialog raises error, both situations occur
try:
ui_lib.create_bookmark({'name': bookmark.name, 'query': query, 'public': True})
except (DisabledWidgetError, NoSuchElementException):
pass
else:
# assert there are no duplicate bookmarks
new_search = session.bookmark.search(bookmark.name)
assert len(new_search) == 1
# assert bookmark query wasn't overriden
assert new_search[0]['Search query'] == existing_bookmark['Search query']

0 comments on commit a04d098

Please sign in to comment.