Skip to content

Commit

Permalink
fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantrivedi committed Aug 5, 2024
1 parent 689296f commit e14c3d7
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions api/tests/unit/sales_dashboard/test_unit_sales_dashboard_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,16 @@ def test_get_organisation_info__get_event_list_for_organisation(

def test_list_organisations_search_by_name(
organisation: Organisation,
client: Client,
admin_user: FFAdminUser,
superuser_client: Client,
) -> None:
# Given
# use the truncated organisation name to ensure fuzzy search works
search_term = organisation.name[1:-1]

url = "%s?search=%s" % (reverse("sales_dashboard:index"), search_term)
client.force_login(admin_user)

# When
response = client.get(url)
response = superuser_client.get(url)

# Then
assert response.status_code == 200
Expand All @@ -92,17 +90,15 @@ def test_list_organisations_search_by_name(
def test_list_organisations_search_by_subscription_id(
organisation: Organisation,
chargebee_subscription: Subscription,
client: Client,
admin_user: FFAdminUser,
superuser_client: Client,
) -> None:
# Given
search_term = chargebee_subscription.subscription_id

url = "%s?search=%s" % (reverse("sales_dashboard:index"), search_term)
client.force_login(admin_user)

# When
response = client.get(url)
response = superuser_client.get(url)

# Then
assert response.status_code == 200
Expand All @@ -111,17 +107,16 @@ def test_list_organisations_search_by_subscription_id(

def test_list_organisations_search_by_user_email(
organisation: Organisation,
client: Client,
superuser_client: Client,
admin_user: FFAdminUser,
) -> None:
# Given
search_term = admin_user.email

url = "%s?search=%s" % (reverse("sales_dashboard:index"), search_term)
client.force_login(admin_user)

# When
response = client.get(url)
response = superuser_client.get(url)

# Then
assert response.status_code == 200
Expand All @@ -131,18 +126,16 @@ def test_list_organisations_search_by_user_email(
def test_list_organisations_filter_plan(
organisation: Organisation,
chargebee_subscription: Subscription,
client: Client,
admin_user: FFAdminUser,
superuser_client: Client,
) -> None:
# Given
url = "%s?filter_plan=%s" % (
reverse("sales_dashboard:index"),
chargebee_subscription.plan,
)
client.force_login(admin_user)

# When
response = client.get(url)
response = superuser_client.get(url)

# Then
assert response.status_code == 200
Expand Down

0 comments on commit e14c3d7

Please sign in to comment.