-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(funnel): add snapshot test for funnel trend query for postgres
This test just checks the Funnel with `display="ActionsLineGraph"` against what it previously did before #5997 was merged. This code path was previously untested, so the issue wasn't picked up and resulted in #6530
- Loading branch information
Harry Waye
committed
Oct 19, 2021
1 parent
49761a3
commit ac06072
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
from unittest.mock import patch | ||
from datetime import datetime | ||
|
||
import pytz | ||
|
||
from freezegun import freeze_time | ||
|
||
|
@@ -410,6 +413,45 @@ def test_funnel_filter_by_action_with_person_properties(self): | |
|
||
self.assertEqual(result[0]["count"], 2) | ||
|
||
def test_funnel_with_display_set_to_trends_linear(self): | ||
""" | ||
This is a limited regression test to ensure that the issue | ||
highlighted by https://github.com/PostHog/posthog/issues/6530 is | ||
resolved. | ||
I am not attempting to evaluate the correctness of | ||
`ActionsLineGraph` with this test, just that it is the same as | ||
before https://github.com/PostHog/posthog/pull/5997#event-5326521193 | ||
was introduceed. | ||
""" | ||
with freeze_time("2020-01-01"): | ||
person_factory(distinct_ids=["person1"], team_id=self.team.pk, properties={"email": "[email protected]"}) | ||
event_factory(distinct_id="person1", event="event1", team=self.team) | ||
event_factory(distinct_id="person1", event="event2", team=self.team) | ||
|
||
result = Funnel( | ||
filter=Filter( | ||
data={ | ||
"events": [{"id": "event1"}, {"id": "event2"}], | ||
"insight": INSIGHT_FUNNELS, | ||
"display": "ActionsLineGraph", | ||
"interval": "day", | ||
# Just get today, so the response isn't massive | ||
"date_from": "-0days", | ||
} | ||
), | ||
team=self.team, | ||
).run() | ||
|
||
assert result == [ | ||
{ | ||
"count": 0, | ||
"data": [100], | ||
"days": [datetime(2020, 1, 1).replace(tzinfo=pytz.UTC)], | ||
"labels": ["1-Jan-2020"], | ||
} | ||
] | ||
|
||
return TestGetFunnel | ||
|
||
|
||
|