Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Aug 15, 2024
1 parent 48a0c6e commit 29f2a11
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
3 changes: 2 additions & 1 deletion workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ WORKDIR /opt/airflow
COPY --chown=airflow:root dags ./dags/
COPY --chown=airflow:root plugins ./plugins/
COPY --chown=airflow:root requirements.txt ./requirements.txt
COPY --chown=airflow:root requirements-test.txt ./requirements-test.txt

RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt -r requirements-test.txt
42 changes: 40 additions & 2 deletions workflows/tests/test_author_create_tasks.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
def create_decision_on_curation_choice():
pass
from workflows.dags.author.author_create.shared_tasks import (
create_decision_on_curation_choice,
)


def test_create_decision_on_curation_choice():
create_decision_on_curation_choice()


# class TestMyTask(unittest.TestCase):
# @patch("my_dag_module.some_dependency")
# def test_my_task(self, mock_dependency):
# # Arrange: Set up any necessary state or mock returns
# mock_dependency.return_value = "expected_value"

# # Act: Execute the task logic directly
# result = my_task_function()

# # Assert: Verify the results are as expected
# self.assertEqual(result, "expected_output")


# class TestMyDag(unittest.TestCase):
# def setUp(self):
# self.dagbag = DagBag()
# self.dag = self.dagbag.get_dag(dag_id="my_dag_id")
# self.task = self.dag.get_task("my_task_id")

# def test_task_execution(self):
# # You can simulate running the task
# from airflow.models import TaskInstance
# from airflow.utils.dates import days_ago

# ti = TaskInstance(task=self.task, execution_date=days_ago(1))

# # You can optionally mock dependencies here

# # Execute the task and assert the outcome
# ti.run(ignore_ti_state=True) # Ignore previous task instance state
# self.assertEqual(ti.state, State.SUCCESS)

0 comments on commit 29f2a11

Please sign in to comment.