Refactor activity methods and update requirements.txt to enhance functionality and remove deprecated filters. Added detailed docstrings for clarity and improved error handling in data processing workflows.
33 lines
980 B
Python
33 lines
980 B
Python
from unittest.mock import MagicMock
|
|
from laborious.activities.base import BaseActivity
|
|
from pytest import fixture
|
|
from sientia_do.notifications.models import Notification
|
|
|
|
|
|
@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(
|
|
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"
|