Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): mock query runner in virtual property test to prevent data pollution (#66145)

mendral-app[bot]499910b2d6c1
diff --git a/ee/hogai/chat_agent/query_planner/test/test_toolkit.py b/ee/hogai/chat_agent/query_planner/test/test_toolkit.py
index a4e6fe161947..5151d78bff06 100644
--- a/ee/hogai/chat_agent/query_planner/test/test_toolkit.py
+++ b/ee/hogai/chat_agent/query_planner/test/test_toolkit.py
@@ -221,7 +221,17 @@ class TestTaxonomyAgentToolkit(ClickhouseTestMixin, APIBaseTest):
'"Paid Search", "Organic Video", "Direct" and many more distinct values.',
)
- def test_retrieve_entity_property_values_virtual_property_without_examples(self):
+ @patch("ee.hogai.chat_agent.query_planner.toolkit.ActorsPropertyTaxonomyQueryRunner")
+ def test_retrieve_entity_property_values_virtual_property_without_examples(self, mock_runner_class):
+ now = datetime(2024, 1, 1, tzinfo=UTC)
+ mock_runner_class.return_value.run.return_value = CachedActorsPropertyTaxonomyQueryResponse(
+ cache_key="test",
+ is_cached=True,
+ last_refresh=now,
+ next_allowed_client_refresh=now,
+ results=[],
+ timezone="UTC",
+ )
create_group_type_mapping_without_created_at(
team=self.team, project_id=self.team.project_id, group_type_index=0, group_type="proj"
)