Skip to content

Commit

Permalink
used loop over all available subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysawant committed Feb 18, 2025
1 parent 85d8460 commit 9846da6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/foreman/ui/test_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,21 +559,20 @@ def test_positive_populate_future_date_subcription(
:customerscenario: true
"""
with target_sat.ui_session() as session:
session.organization.select(function_org.name)
session.organization.select("Default Organization")
assert session.subscription.has_manifest, 'Manifest not uploaded'

# Get current date time and convert into date
current_datetime = datetime.now(ZoneInfo(get_localzone_name()))
current_date = current_datetime.date()

# Get subscription Start Date
# Get subscription Start Date and compare with current date
subscriptions = session.subscription.read_subscriptions()
subscription_startdate = subscriptions[0]['Start Date']
sub_datetime = datetime.strptime(subscription_startdate, '%Y-%m-%d %H:%M:%S %z')
sub_date = sub_datetime.date()

# Compare the dates
assert sub_date > current_date, "Subscription start date is not in the future"
if not any(
datetime.strptime(sub['Start Date'], '%Y-%m-%d %H:%M:%S %z').date() > current_date
for sub in subscriptions
):
raise AssertionError('Subscription start date is not in the future')

# Delete the manifest from Organization
session.subscription.delete_manifest(
Expand Down

0 comments on commit 9846da6

Please sign in to comment.