Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilbert09 committed Mar 12, 2024
1 parent d3ef5a8 commit aa883ff
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 8 deletions.
4 changes: 0 additions & 4 deletions mypy-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,6 @@ posthog/hogql/database/schema/test/test_channel_type.py:0: error: Value of type
posthog/api/organization_member.py:0: error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc]
ee/api/feature_flag_role_access.py:0: error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc]
ee/clickhouse/views/insights.py:0: error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc]
posthog/temporal/tests/external_data/test_external_data_job.py:0: error: Missing positional argument "table_schema" in call to "ValidateSchemaInputs" [call-arg]
posthog/temporal/tests/external_data/test_external_data_job.py:0: error: Missing positional argument "table_schema" in call to "ValidateSchemaInputs" [call-arg]
posthog/temporal/tests/external_data/test_external_data_job.py:0: error: Missing positional argument "table_schema" in call to "ValidateSchemaInputs" [call-arg]
posthog/temporal/tests/external_data/test_external_data_job.py:0: error: Missing positional argument "table_schema" in call to "ValidateSchemaInputs" [call-arg]
posthog/queries/trends/test/test_person.py:0: error: "str" has no attribute "get" [attr-defined]
posthog/queries/trends/test/test_person.py:0: error: Invalid index type "int" for "HttpResponse"; expected type "str | bytes" [index]
posthog/queries/trends/test/test_person.py:0: error: "str" has no attribute "get" [attr-defined]
Expand Down
57 changes: 53 additions & 4 deletions posthog/temporal/tests/external_data/test_external_data_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,18 @@ async def test_validate_schema_and_update_table_activity(activity_environment, t
mock_get_columns.return_value = {"id": "string"}
await activity_environment.run(
validate_schema_activity,
ValidateSchemaInputs(run_id=new_job.pk, team_id=team.id, schemas=schemas),
ValidateSchemaInputs(
run_id=new_job.pk,
team_id=team.id,
schemas=schemas,
table_schema={
"test-1": {"name": "test-1", "resource": "test-1", "columns": {"id": {"data_type": "text"}}},
"test-2": {"name": "test-2", "resource": "test-2", "columns": {"id": {"data_type": "text"}}},
"test-3": {"name": "test-3", "resource": "test-3", "columns": {"id": {"data_type": "text"}}},
"test-4": {"name": "test-4", "resource": "test-4", "columns": {"id": {"data_type": "text"}}},
"test-5": {"name": "test-5", "resource": "test-5", "columns": {"id": {"data_type": "text"}}},
},
),
)

assert mock_get_columns.call_count == 10
Expand Down Expand Up @@ -584,7 +595,18 @@ async def test_validate_schema_and_update_table_activity_with_existing(activity_
mock_get_columns.return_value = {"id": "string"}
await activity_environment.run(
validate_schema_activity,
ValidateSchemaInputs(run_id=new_job.pk, team_id=team.id, schemas=schemas),
ValidateSchemaInputs(
run_id=new_job.pk,
team_id=team.id,
schemas=schemas,
table_schema={
"test-1": {"name": "test-1", "resource": "test-1", "columns": {"id": {"data_type": "text"}}},
"test-2": {"name": "test-2", "resource": "test-2", "columns": {"id": {"data_type": "text"}}},
"test-3": {"name": "test-3", "resource": "test-3", "columns": {"id": {"data_type": "text"}}},
"test-4": {"name": "test-4", "resource": "test-4", "columns": {"id": {"data_type": "text"}}},
"test-5": {"name": "test-5", "resource": "test-5", "columns": {"id": {"data_type": "text"}}},
},
),
)

assert mock_get_columns.call_count == 10
Expand Down Expand Up @@ -640,7 +662,23 @@ async def test_validate_schema_and_update_table_activity_half_run(activity_envir

await activity_environment.run(
validate_schema_activity,
ValidateSchemaInputs(run_id=new_job.pk, team_id=team.id, schemas=schemas),
ValidateSchemaInputs(
run_id=new_job.pk,
team_id=team.id,
schemas=schemas,
table_schema={
"broken_schema": {
"name": "broken_schema",
"resource": "broken_schema",
"columns": {"id": {"data_type": "text"}},
},
"test_schema": {
"name": "test_schema",
"resource": "test_schema",
"columns": {"id": {"data_type": "text"}},
},
},
),
)

assert mock_get_columns.call_count == 1
Expand Down Expand Up @@ -688,7 +726,18 @@ async def test_create_schema_activity(activity_environment, team, **kwargs):
mock_get_columns.return_value = {"id": "string"}
await activity_environment.run(
validate_schema_activity,
ValidateSchemaInputs(run_id=new_job.pk, team_id=team.id, schemas=schemas),
ValidateSchemaInputs(
run_id=new_job.pk,
team_id=team.id,
schemas=schemas,
table_schema={
"test-1": {"name": "test-1", "resource": "test-1", "columns": {"id": {"data_type": "text"}}},
"test-2": {"name": "test-2", "resource": "test-2", "columns": {"id": {"data_type": "text"}}},
"test-3": {"name": "test-3", "resource": "test-3", "columns": {"id": {"data_type": "text"}}},
"test-4": {"name": "test-4", "resource": "test-4", "columns": {"id": {"data_type": "text"}}},
"test-5": {"name": "test-5", "resource": "test-5", "columns": {"id": {"data_type": "text"}}},
},
),
)

assert mock_get_columns.call_count == 10
Expand Down

0 comments on commit aa883ff

Please sign in to comment.