Skip to content

Commit

Permalink
fix: API tests now work with model parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Jun 24, 2024
1 parent e807d90 commit c894d48
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion posthog/api/test/batch_exports/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def test_create_batch_export_with_custom_schema(client: HttpClient):
}

assert batch_export.schema == expected_schema
assert args["batch_export_schema"] == expected_schema
assert args["batch_export_model"] == {"name": "events", "schema": expected_schema}


@pytest.mark.parametrize(
Expand Down
37 changes: 20 additions & 17 deletions posthog/api/test/batch_exports/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,23 +315,26 @@ def test_can_patch_hogql_query(client: HttpClient):
args = json.loads(decoded_payload[0].data)
assert args["bucket_name"] == "my-production-s3-bucket"
assert args["interval"] == "hour"
assert args["batch_export_schema"] == {
"fields": [
{
"alias": "uuid",
"expression": "toString(events.uuid)",
},
{
"alias": "test",
"expression": "%(hogql_val_0)s",
},
{
"alias": "n",
"expression": "accurateCastOrNull(plus(1, 1), %(hogql_val_1)s)",
},
],
"values": {"hogql_val_0": "test", "hogql_val_1": "Int64"},
"hogql_query": "SELECT toString(uuid) AS uuid, 'test' AS test, toInt(plus(1, 1)) AS n FROM events",
assert args["batch_export_model"] == {
"name": "events",
"schema": {
"fields": [
{
"alias": "uuid",
"expression": "toString(events.uuid)",
},
{
"alias": "test",
"expression": "%(hogql_val_0)s",
},
{
"alias": "n",
"expression": "accurateCastOrNull(plus(1, 1), %(hogql_val_1)s)",
},
],
"values": {"hogql_val_0": "test", "hogql_val_1": "Int64"},
"hogql_query": "SELECT toString(uuid) AS uuid, 'test' AS test, toInt(plus(1, 1)) AS n FROM events",
},
}


Expand Down

0 comments on commit c894d48

Please sign in to comment.