(self)
| 4993 | |
| 4994 | @snapshot_clickhouse_queries |
| 4995 | def test_timezones_hourly(self): |
| 4996 | self.team.timezone = "US/Pacific" |
| 4997 | self.team.save() |
| 4998 | _create_person(team_id=self.team.pk, distinct_ids=["blabla"], properties={}) |
| 4999 | with freeze_time("2020-01-05T06:01:01Z"): # Previous day in pacific time, don't include |
| 5000 | _create_event( |
| 5001 | team=self.team, |
| 5002 | event="sign up", |
| 5003 | distinct_id="blabla", |
| 5004 | properties={"$current_url": "first url", "$browser": "Firefox", "$os": "Mac"}, |
| 5005 | ) |
| 5006 | with freeze_time("2020-01-05T15:01:01Z"): # 07:01 in pacific time |
| 5007 | _create_event( |
| 5008 | team=self.team, |
| 5009 | event="sign up", |
| 5010 | distinct_id="blabla", |
| 5011 | properties={"$current_url": "first url", "$browser": "Firefox", "$os": "Mac"}, |
| 5012 | ) |
| 5013 | with freeze_time("2020-01-05T16:01:01Z"): # 08:01 in pacific time |
| 5014 | _create_event( |
| 5015 | team=self.team, |
| 5016 | event="sign up", |
| 5017 | distinct_id="blabla", |
| 5018 | properties={"$current_url": "first url", "$browser": "Firefox", "$os": "Mac"}, |
| 5019 | ) |
| 5020 | |
| 5021 | with freeze_time("2020-01-05T18:01:01Z"): # 10:01 in pacific time |
| 5022 | response = Trends().run( |
| 5023 | Filter( |
| 5024 | data={ |
| 5025 | "date_from": "dStart", |
| 5026 | "interval": "hour", |
| 5027 | "events": [{"id": "sign up", "name": "sign up", "math": "dau"}], |
| 5028 | }, |
| 5029 | team=self.team, |
| 5030 | ), |
| 5031 | self.team, |
| 5032 | ) |
| 5033 | self.assertEqual( |
| 5034 | response[0]["labels"], |
| 5035 | [ |
| 5036 | "5-Jan-2020 00:00", |
| 5037 | "5-Jan-2020 01:00", |
| 5038 | "5-Jan-2020 02:00", |
| 5039 | "5-Jan-2020 03:00", |
| 5040 | "5-Jan-2020 04:00", |
| 5041 | "5-Jan-2020 05:00", |
| 5042 | "5-Jan-2020 06:00", |
| 5043 | "5-Jan-2020 07:00", |
| 5044 | "5-Jan-2020 08:00", |
| 5045 | "5-Jan-2020 09:00", |
| 5046 | "5-Jan-2020 10:00", |
| 5047 | ], |
| 5048 | ) |
| 5049 | self.assertEqual(response[0]["data"], [0.0, 0.0, 0.0, 0.0, 0, 0, 0, 1, 1, 0, 0]) |
| 5050 | persons = self.client.get("/" + response[0]["persons_urls"][7]["url"]).json() |
| 5051 | self.assertEqual(persons["results"][0]["count"], 1) |
| 5052 |
nothing calls this directly
no test coverage detected