From 637d82da175f712bb02269ce5a67d506d1615e2f Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 14 Feb 2024 11:24:59 -0500 Subject: [PATCH] add test for entity property and non entity property filter --- .../test/test_data_warehouse_query_builder.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/posthog/hogql_queries/insights/trends/test/test_data_warehouse_query_builder.py b/posthog/hogql_queries/insights/trends/test/test_data_warehouse_query_builder.py index 7b6f41ff82ffe..fc5ffae5b8e10 100644 --- a/posthog/hogql_queries/insights/trends/test/test_data_warehouse_query_builder.py +++ b/posthog/hogql_queries/insights/trends/test/test_data_warehouse_query_builder.py @@ -148,7 +148,7 @@ def test_trends_data_warehouse(self): assert set(response.columns).issubset({"date", "total"}) assert response.results[0][1] == [1, 1, 1, 1, 0, 0, 0] - def test_trends_property(self): + def test_trends_entity_property(self): table_name = self.create_parquet_file() trends_query = TrendsQuery( @@ -170,3 +170,20 @@ def test_trends_property(self): assert response.columns is not None assert set(response.columns).issubset({"date", "total"}) assert response.results[0][1] == [1, 0, 0, 0, 0, 0, 0] + + def test_trends_property(self): + table_name = self.create_parquet_file() + + trends_query = TrendsQuery( + kind="TrendsQuery", + dateRange=DateRange(date_from="2023-01-01"), + series=[DataWarehouseNode(table_name=table_name, id_field="id", timestamp_field="created")], + properties=clean_entity_properties([{"key": "prop_1", "value": "a", "type": "data_warehouse"}]), + ) + + with freeze_time("2023-01-07"): + response = self.get_response(trends_query=trends_query) + + assert response.columns is not None + assert set(response.columns).issubset({"date", "total"}) + assert response.results[0][1] == [1, 0, 0, 0, 0, 0, 0]