-
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.
Avoid crashing on empty or non-existent timezone
- Loading branch information
1 parent
3a98085
commit 4a43be8
Showing
2 changed files
with
47 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -1099,3 +1099,49 @@ def test_timezone_filter_with_invalid_timezone(self): | |
None, | ||
breakdown_by=WebStatsBreakdown.TIMEZONE, | ||
) | ||
|
||
def test_timezone_filter_with_empty_timezone(self): | ||
did = "id" | ||
sid = str(uuid7("2019-02-17")) | ||
|
||
_create_person( | ||
team_id=self.team.pk, | ||
distinct_ids=[did], | ||
properties={"name": sid, "email": f"[email protected]"}, | ||
) | ||
|
||
# Key not exists | ||
_create_event( | ||
team=self.team, | ||
event="$pageview", | ||
distinct_id=did, | ||
timestamp=f"2019-02-17 00:00:00", | ||
properties={"$session_id": sid, "$pathname": f"/path1"}, | ||
) | ||
|
||
# Key exists, it's null | ||
_create_event( | ||
team=self.team, | ||
event="$pageview", | ||
distinct_id=did, | ||
timestamp=f"2019-02-17 00:00:00", | ||
properties={"$session_id": sid, "$pathname": f"/path1", "$timezone": None}, | ||
) | ||
|
||
# Key exists, it's empty string | ||
_create_event( | ||
team=self.team, | ||
event="$pageview", | ||
distinct_id=did, | ||
timestamp=f"2019-02-17 00:00:00", | ||
properties={"$session_id": sid, "$pathname": f"/path1", "$timezone": ""}, | ||
) | ||
|
||
results = self._run_web_stats_table_query( | ||
"all", | ||
None, | ||
breakdown_by=WebStatsBreakdown.TIMEZONE, | ||
).results | ||
|
||
# Don't crash, treat all of them null | ||
assert results == [] |