diff --git a/requirements.txt b/requirements.txt index f7a80cf..53ef9e2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,5 @@ redis couchbase pymongo jinja2 -git+ssh://git@github.com/Aignosi/sientia-dataops-library.git@1.3.7 +git+ssh://git@github.com/Aignosi/sientia-dataops-library.git@1.3.8 prometheus-client diff --git a/tests/orchestrator/activities/test_formatters.py b/tests/orchestrator/activities/test_formatters.py index ef89e9b..f3c1397 100644 --- a/tests/orchestrator/activities/test_formatters.py +++ b/tests/orchestrator/activities/test_formatters.py @@ -816,10 +816,5 @@ async def test_filter_notification_reports(formatters): 'notification_id': 'test_notification_id_3' } ] - }, - 'test_group_2': { - 'group_name': 'test_group_2', - 'contents': ['core_alerts'], - 'notifications': [] } } diff --git a/tests/orchestrator/workflows/test_alerts.py b/tests/orchestrator/workflows/test_alerts.py index 0dfffd3..56c1406 100644 --- a/tests/orchestrator/workflows/test_alerts.py +++ b/tests/orchestrator/workflows/test_alerts.py @@ -1,4 +1,4 @@ -from unittest.mock import AsyncMock, patch, ANY, call +from unittest.mock import AsyncMock, MagicMock, patch, ANY, call from pytest import fixture, mark from orchestrator.workflows.alerts import Alerts from orchestrator.activities.activities import Activities @@ -115,3 +115,22 @@ async def test_run_no_data(workflow_mock, alerts): ]) workflow_mock.execute_local_activity_method.assert_not_called() + + +@mark.asyncio +@patch("orchestrator.workflows.alerts.workflow", new_callable=AsyncMock) +async def test_run_no_log_report(workflow_mock, alerts): + workflow_mock.execute_child_workflow.side_effect = [ + MagicMock(), + [] + ] + + input_data = { + 'schedule_name': 'test-schedule-name', + 'notification_ttl': 300, + 'sent_ttl': 600 + } + + await alerts.run(input_data) + + workflow_mock.execute_activity_method.assert_not_called() diff --git a/tests/orchestrator/workflows/test_reports.py b/tests/orchestrator/workflows/test_reports.py index 1b1983d..d0134d8 100644 --- a/tests/orchestrator/workflows/test_reports.py +++ b/tests/orchestrator/workflows/test_reports.py @@ -97,3 +97,19 @@ async def test_run_no_data(workflow_mock, reports): ]) workflow_mock.execute_local_activity_method.assert_not_called() + + +@mark.asyncio +@patch("orchestrator.workflows.reports.workflow", new_callable=AsyncMock) +async def test_run_no_groups(workflow_mock, reports): + workflow_mock.execute_local_activity_method.return_value = [] + + input_data = { + 'schedule_name': 'test-schedule-name', + 'notification_ttl': 300, + 'sent_ttl': 600 + } + + await reports.run(input_data) + + workflow_mock.execute_child_workflow.assert_called_once()