Skip to content

Commit

Permalink
Add test covering build_and_run_cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvdende committed Mar 22, 2024
1 parent 07cf582 commit c1bc9a4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/operators/test_azure_container_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,25 @@ def test_dbt_azure_container_instance_build_command():
"start_time: '{{ data_interval_start.strftime(''%Y%m%d%H%M%S'') }}'\n",
"--no-version-check",
]


@patch("cosmos.operators.azure_container_instance.AzureContainerInstancesOperator.execute")
def test_dbt_azure_container_instance_build_and_run_cmd(mock_execute):
dbt_base_operator = ConcreteDbtAzureContainerInstanceOperator(
ci_conn_id="my_airflow_connection",
task_id="my-task",
image="my_image",
region="Mordor",
name="my-aci",
resource_group="my-rg",
project_dir="my/dir",
environment_variables={"FOO": "BAR"},
)
mock_build_command = MagicMock()
dbt_base_operator.build_command = mock_build_command

mock_context = MagicMock()
dbt_base_operator.build_and_run_cmd(context=mock_context)

mock_build_command.assert_called_with(mock_context, None)
mock_execute.assert_called_once_with(dbt_base_operator, mock_context)

0 comments on commit c1bc9a4

Please sign in to comment.