Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Nov 15, 2024
1 parent 6f67648 commit 55181c1
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/operators/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from cosmos.hooks.subprocess import FullOutputSubprocessResult
from cosmos.operators.local import (
DbtBuildLocalOperator,
DbtCloneLocalOperator,
DbtCompileLocalOperator,
DbtDocsAzureStorageLocalOperator,
DbtDocsGCSLocalOperator,
Expand Down Expand Up @@ -1283,3 +1284,44 @@ def test_upload_compiled_sql_should_upload(mock_configure_remote, mock_object_st
expected_dest_path = f"mock_remote_path/test_dag/compiled/{rel_path.lstrip('/')}"
mock_object_storage_path.assert_any_call(expected_dest_path, conn_id="mock_conn_id")
mock_object_storage_path.return_value.copy.assert_any_call(mock_object_storage_path.return_value)


@pytest.mark.integration
def test_clone_operator(caplog):

with DAG("test-id-1", start_date=datetime(2022, 1, 1)) as dag:
seed_operator = DbtSeedLocalOperator(
profile_config=real_profile_config,
project_dir=DBT_PROJ_DIR,
task_id="seed",
dbt_cmd_flags=["--select", "raw_customers"],
install_deps=True,
append_env=True,
emit_datasets=False,
)
run_operator = DbtRunLocalOperator(
profile_config=real_profile_config,
project_dir=DBT_PROJ_DIR,
task_id="run",
dbt_cmd_flags=["--models", "stg_customers"],
install_deps=True,
append_env=True,
emit_datasets=False,
)

clone_operator = DbtCloneLocalOperator(
profile_config=real_profile_config,
project_dir=DBT_PROJ_DIR,
task_id="clone",
dbt_cmd_flags=["--models", "stg_customers"],
install_deps=True,
append_env=True,
emit_datasets=False,
)

seed_operator >> run_operator >> clone_operator

run_test_dag(dag)

assert run_operator.inlets == []
assert run_operator.outlets == []

0 comments on commit 55181c1

Please sign in to comment.