Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(revenue-analytics): drop narration comments from stripe subscription tests (#99734)

posthog[bot]1f9b50c6bca1
diff --git a/products/revenue_analytics/backend/views/sources/test/stripe/test_stripe_subscription.py b/products/revenue_analytics/backend/views/sources/test/stripe/test_stripe_subscription.py
index 5c96a0993a3f..53b08cd60ffd 100644
--- a/products/revenue_analytics/backend/views/sources/test/stripe/test_stripe_subscription.py
+++ b/products/revenue_analytics/backend/views/sources/test/stripe/test_stripe_subscription.py
@@ -11,25 +11,20 @@ class TestSubscriptionStripeBuilder(StripeSourceBaseTest):
def test_build_subscription_query_with_subscription_schema(self):
"""Test building subscription query when subscription schema exists."""
- # Setup with only subscription schema
self.setup_stripe_external_data_source(schemas=[SUBSCRIPTION_RESOURCE_NAME])
subscription_table = self.get_stripe_table_by_schema_name(SUBSCRIPTION_RESOURCE_NAME)
- # Test the query structure
query = build(self.stripe_handle)
self.assertQueryContainsFields(query.query, SUBSCRIPTION_SCHEMA)
self.assertBuiltQueryStructure(query, str(subscription_table.id), f"stripe.{self.external_data_source.prefix}")
- # Print and snapshot the generated HogQL query
query_sql = query.query.to_hogql()
self.assertQueryMatchesSnapshot(query_sql, replace_all_numbers=True)
def test_build_with_no_subscription_schema(self):
"""Test that build returns view even when no subscription schema exists."""
- # Setup without subscription schema
self.setup_stripe_external_data_source(schemas=[])
- # Test the query structure
query = build(self.stripe_handle)
self.assertQueryContainsFields(query.query, SUBSCRIPTION_SCHEMA)
self.assertBuiltQueryStructure(
@@ -39,18 +34,15 @@ class TestSubscriptionStripeBuilder(StripeSourceBaseTest):
expected_test_comments="no_schema",
)
- # Print and snapshot the generated HogQL query
query_sql = query.query.to_hogql()
self.assertQueryMatchesSnapshot(query_sql, replace_all_numbers=True)
def test_build_with_subscription_schema_but_no_table(self):
"""Test that build returns view even when subscription schema exists but has no table."""
- # Setup with subscription schema but no table
self.setup_stripe_external_data_source_with_specific_schemas(
[{"name": SUBSCRIPTION_RESOURCE_NAME, "table_name": None}]
)
- # Test the query structure
query = build(self.stripe_handle)
self.assertQueryContainsFields(query.query, SUBSCRIPTION_SCHEMA)
self.assertBuiltQueryStructure(
@@ -60,7 +52,6 @@ class TestSubscriptionStripeBuilder(StripeSourceBaseTest):
expected_test_comments="no_table",
)
- # Print and snapshot the generated HogQL query
query_sql = query.query.to_hogql()
self.assertQueryMatchesSnapshot(query_sql, replace_all_numbers=True)
@@ -78,10 +69,8 @@ class TestSubscriptionStripeBuilder(StripeSourceBaseTest):
query = build(self.stripe_handle)
query_sql = query.query.to_hogql()
- # Check for specific fields in the query based on the subscription schema
self.assertIn("id", query_sql)
self.assertIn("source_label", query_sql)
- # Check that source_label contains the expected prefix
expected_prefix = f"stripe.{self.external_data_source.prefix}"
self.assertIn(f"'{expected_prefix}'", query_sql)