Skip to content

Commit

Permalink
fix: Typo in template field (#130)
Browse files Browse the repository at this point in the history
* test: Add test for dbt ls with default resource types

* fix: Typo in template field
  • Loading branch information
tomasfarias authored Jan 30, 2024
1 parent 2028102 commit f8355c5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airflow_dbt_python/operators/dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ class DbtLsOperator(DbtBaseOperator):
"""

template_fields = (
base_template_fields + selection_template_fields + ["resource_type"]
base_template_fields + selection_template_fields + ["resource_types"]
)

def __init__(
Expand Down
38 changes: 38 additions & 0 deletions tests/operators/test_dbt_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,41 @@ def test_dbt_ls_all(
]

assert all_files == expected


def test_dbt_ls_all_with_default(
profiles_file,
dbt_project_file,
seed_files,
model_files,
singular_tests_files,
generic_tests_files,
snapshot_files,
):
"""Test dbt list operator by listing all resources."""
op = DbtLsOperator(
task_id="dbt_task",
project_dir=dbt_project_file.parent,
profiles_dir=profiles_file.parent,
do_xcom_push=True,
)
all_files = op.execute({})

expected = [
"test.model_1",
"test.model_2",
"test.model_3",
"test.model_4",
"test.seed_1",
"test.seed_2",
"test.snapshot_1.test_snapshot",
"test.accepted_values_model_2_field1__123__456",
"test.not_null_model_2_field1",
"test.not_null_model_2_field2",
"test.singular_test_1",
"test.singular_test_2",
"test.unique_model_2_field1",
"test.unique_model_2_field2",
]

assert all_files == expected

0 comments on commit f8355c5

Please sign in to comment.