Test for processing erroring workflows.

This only tests that we have good information in the message, not whether the message was sent.
This commit is contained in:
mike cullerton 2022-01-25 12:19:32 -05:00
parent ae86ab4790
commit 467d99f698
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
from tests.base_test import BaseTest
from crc import session
from crc.models.workflow import WorkflowStatus
from crc.services.workflow_service import WorkflowService
class TestErrorWorkflows(BaseTest):
def test_error_workflows(self):
workflow_1 = self.create_workflow('random_fact')
workflow_1.status = WorkflowStatus.erroring
workflow_2 = self.create_workflow('random_fact')
workflow_2.status = WorkflowStatus.erroring
session.commit()
message = WorkflowService().process_erroring_workflows()
self.assertIn('There are 2 workflows in an error state.', message)
self.assertIn(f'workflow/{workflow_1.id}', message)
self.assertIn(f'workflow/{workflow_2.id}', message)