Skip to content

Commit

Permalink
fix bad test
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech committed Oct 16, 2024
1 parent 57d25e9 commit 54b1a4a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions posthog/api/test/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,19 @@ def test_person_property_filter(self):
def test_safe_clickhouse_error_passed_through(self):
query = {"kind": "EventsQuery", "select": ["timestamp + 'string'"]}

response_post = self.client.post(f"/api/projects/{self.team.id}/query/", {"query": query})
self.assertEqual(response_post.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(
response_post.json(),
self.validation_error_response(
"Illegal types DateTime64(6, 'UTC') and String of arguments of function plus: "
"While processing toTimeZone(timestamp, 'UTC') + 'string'.",
"illegal_type_of_argument",
),
)
with freeze_time("2024-10-16 22:10:29.691212"):
response_post = self.client.post(f"/api/projects/{self.team.id}/query/", {"query": query})
self.assertEqual(response_post.status_code, status.HTTP_400_BAD_REQUEST)

self.assertEqual(
response_post.json(),
{
"type": "validation_error",
"code": "illegal_type_of_argument",
"detail": f"Illegal types DateTime64(6, 'UTC') and String of arguments of function plus: In scope SELECT toTimeZone(events.timestamp, 'UTC') + 'string' FROM events WHERE (events.team_id = {self.team.id}) AND (toTimeZone(events.timestamp, 'UTC') < toDateTime64('2024-10-16 22:10:34.691212', 6, 'UTC')) AND (toTimeZone(events.timestamp, 'UTC') > toDateTime64('2024-10-15 22:10:29.691212', 6, 'UTC')) ORDER BY toTimeZone(events.timestamp, 'UTC') + 'string' ASC LIMIT 0, 101 SETTINGS readonly = 2, max_execution_time = 60, allow_experimental_object_type = 1, format_csv_allow_double_quotes = 0, max_ast_elements = 4000000, max_expanded_ast_elements = 4000000, max_bytes_before_external_group_by = 0.",
"attr": None,
},
)

@patch(
"posthog.clickhouse.client.execute._annotate_tagged_query", return_value=("SELECT 1&&&", {})
Expand Down

0 comments on commit 54b1a4a

Please sign in to comment.