From fdcea94610a9cfa2b91e3daeb1913f51429256e3 Mon Sep 17 00:00:00 2001 From: vijay sawant Date: Mon, 3 Jun 2024 17:05:25 +0530 Subject: [PATCH] 6.15.z-alernative solution for default subscription search option (#15237) * alernative solution for default subscription search option * addressed review comments, shorten the for loop (cherry picked from commit eba532082d8753d69232abcecd7a9b41f922c1ce) --- tests/foreman/ui/test_subscription.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/foreman/ui/test_subscription.py b/tests/foreman/ui/test_subscription.py index 5927bffebb7..19a14c8f13f 100644 --- a/tests/foreman/ui/test_subscription.py +++ b/tests/foreman/ui/test_subscription.py @@ -205,10 +205,11 @@ def test_positive_access_with_non_admin_user_with_manifest( default_organization=org, ).create() with target_sat.ui_session(test_name, user=user.login, password=user_password) as session: - assert ( - session.subscription.search(f'name = "{DEFAULT_SUBSCRIPTION_NAME}"')[0]['Name'] - == DEFAULT_SUBSCRIPTION_NAME - ) + all_subscriptions = session.subscription.read_subscriptions() + assert len(all_subscriptions) > 0 + assert any( + [sub['Name'] == DEFAULT_SUBSCRIPTION_NAME for sub in all_subscriptions] + ), 'Default subsciption not found' @pytest.mark.tier2