Implement workflows for fake data generation, scouter processing, and core scouter operations - Added `FakeData` workflow to generate random data and send it to a Kafka topic. - Implemented `Scouter` workflow to load data from Kafka and trigger the core scouter workflow. - Created `CoreScouter` workflow to process data through quality gates, aggregation, and export to PostgreSQL. - Developed comprehensive unit tests for activities and workflows, ensuring proper functionality and error handling. - Enhanced Redis and Postgres activities with robust testing for data handling and error notifications. - Introduced quality filters for data validation and implemented tests to verify their functionality.
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
from unittest.mock import MagicMock
|
|
from pytest import fixture
|
|
from sientia_do.notifications.models import Notification
|
|
from scouter.activities.base import BaseActivity
|
|
|
|
|
|
@fixture
|
|
def base_activity():
|
|
return BaseActivity(
|
|
logger=MagicMock(),
|
|
notification_handler=MagicMock(),
|
|
)
|
|
|
|
|
|
def test_prepare_activity(base_activity):
|
|
base_activity.notification_handler.base_notification = Notification(
|
|
project="project",
|
|
pipeline="pipeline",
|
|
trigger="-",
|
|
model_name="-",
|
|
model_id="-",
|
|
)
|
|
|
|
base_activity.prepare_activity(
|
|
{
|
|
'workflow_name': 'test_workflow',
|
|
'schedule_name': 'test_schedule',
|
|
'model_name': 'test_model',
|
|
'model_id': 'test_model_id',
|
|
}
|
|
)
|
|
|
|
assert base_activity.notification_handler.base_notification.schedule_name == "test_schedule"
|
|
assert base_activity.notification_handler.base_notification.model_name == "test_model"
|
|
assert base_activity.notification_handler.base_notification.model_id == "test_model_id"
|
|
assert base_activity.notification_handler.base_notification.pipeline_name == "test_workflow"
|