Skip to content

Commit

Permalink
Remove v1 sesisons table test for attribution explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Oct 29, 2024
1 parent fe1710f commit def7c64
Showing 1 changed file with 8 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Optional

from parameterized import parameterized

from posthog.hogql.constants import LimitContext
from posthog.hogql_queries.web_analytics.session_attribution_explorer_query_runner import (
Expand Down Expand Up @@ -80,7 +79,7 @@ def _run_session_attribution_query(
self,
date_from: Optional[str] = None,
date_to: Optional[str] = None,
session_table_version: SessionTableVersion = SessionTableVersion.V1,
session_table_version: SessionTableVersion = SessionTableVersion.V2,
group_by: Optional[list[SessionAttributionGroupBy]] = None,
limit_context: Optional[LimitContext] = None,
properties: Optional[list[SessionPropertyFilter]] = None,
Expand All @@ -94,20 +93,14 @@ def _run_session_attribution_query(
runner = SessionAttributionExplorerQueryRunner(team=self.team, query=query, limit_context=limit_context)
return runner.calculate()

@parameterized.expand([[SessionTableVersion.V1], [SessionTableVersion.V2]])
def test_no_crash_when_no_data(self, session_table_version: SessionTableVersion):
results = self._run_session_attribution_query(
session_table_version=session_table_version,
).results
def test_no_crash_when_no_data(self):
results = self._run_session_attribution_query().results
assert results == [(0, [], [], [], [], [], [], [])]

@parameterized.expand([[SessionTableVersion.V1], [SessionTableVersion.V2]])
def test_group_by_nothing(self, session_table_version: SessionTableVersion):
def test_group_by_nothing(self):
self._create_data()

results = self._run_session_attribution_query(
session_table_version=session_table_version,
).results
results = self._run_session_attribution_query().results

assert results == [
(
Expand All @@ -122,12 +115,10 @@ def test_group_by_nothing(self, session_table_version: SessionTableVersion):
)
]

@parameterized.expand([[SessionTableVersion.V1], [SessionTableVersion.V2]])
def test_group_by_initial_url(self, session_table_version: SessionTableVersion):
def test_group_by_initial_url(self):
self._create_data()

results = self._run_session_attribution_query(
session_table_version=session_table_version,
group_by=[SessionAttributionGroupBy.INITIAL_URL],
).results

Expand Down Expand Up @@ -164,12 +155,10 @@ def test_group_by_initial_url(self, session_table_version: SessionTableVersion):
),
]

@parameterized.expand([[SessionTableVersion.V1], [SessionTableVersion.V2]])
def test_group_channel_medium_source(self, session_table_version: SessionTableVersion):
def test_group_channel_medium_source(self):
self._create_data()

results = self._run_session_attribution_query(
session_table_version=session_table_version,
group_by=[
SessionAttributionGroupBy.CHANNEL_TYPE,
SessionAttributionGroupBy.MEDIUM,
Expand All @@ -191,12 +180,10 @@ def test_group_channel_medium_source(self, session_table_version: SessionTableVe
(1, "Referral", ["referring_domain2"], "source2", "medium2", ["campaign2"], [], ["http://example.com/2"]),
]

@parameterized.expand([[SessionTableVersion.V1], [SessionTableVersion.V2]])
def test_filters(self, session_table_version: SessionTableVersion):
def test_filters(self):
self._create_data()

results = self._run_session_attribution_query(
session_table_version=session_table_version,
group_by=[
SessionAttributionGroupBy.CHANNEL_TYPE,
SessionAttributionGroupBy.MEDIUM,
Expand Down

0 comments on commit def7c64

Please sign in to comment.