Adding unit tests to WorkflowPlayer.py
This commit is contained in:
@@ -5,18 +5,19 @@ from fasthtml.xtend import Script
|
||||
|
||||
from components.workflows.components.WorkflowDesigner import WorkflowDesigner, COMPONENT_TYPES
|
||||
from components.workflows.constants import ProcessorTypes
|
||||
from components.workflows.db_management import WorkflowsDesignerSettings, WorkflowComponent, Connection, \
|
||||
WorkflowComponentRuntimeState
|
||||
from components.workflows.db_management import WorkflowsDesignerSettings, WorkflowComponent, Connection
|
||||
from core.settings_management import SettingsManager, MemoryDbEngine
|
||||
from helpers import matches, Contains
|
||||
from my_mocks import tabs_manager
|
||||
|
||||
TEST_WORKFLOW_DESIGNER_ID = "workflow_designer_id"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def designer(session):
|
||||
def designer(session, tabs_manager):
|
||||
return WorkflowDesigner(session=session, _id=TEST_WORKFLOW_DESIGNER_ID,
|
||||
settings_manager=SettingsManager(engine=MemoryDbEngine()),
|
||||
tabs_manager=tabs_manager,
|
||||
key=TEST_WORKFLOW_DESIGNER_ID,
|
||||
designer_settings=WorkflowsDesignerSettings("Workflow Name"),
|
||||
boundaries={"height": 500, "width": 800}
|
||||
@@ -72,6 +73,7 @@ def test_i_can_render_no_component(designer):
|
||||
expected = Div(
|
||||
H1("Workflow Name"),
|
||||
P("Drag components from the toolbox to the canvas to create your workflow."),
|
||||
Div(id=f"t_{designer.get_id()}"), # media + error message
|
||||
Div(id=f"d_{designer.get_id()}"), # designer container
|
||||
Div(cls="wkf-splitter"),
|
||||
Div(id=f"p_{designer.get_id()}"), # properties panel
|
||||
@@ -84,8 +86,7 @@ def test_i_can_render_no_component(designer):
|
||||
|
||||
def test_i_can_render_a_producer(designer, producer_component):
|
||||
component = producer_component
|
||||
component_state = WorkflowComponentRuntimeState(component.id)
|
||||
actual = designer._mk_component(component, component_state)
|
||||
actual = designer._mk_component(component)
|
||||
expected = Div(
|
||||
# input connection point
|
||||
Div(cls="wkf-connection-point wkf-input-point",
|
||||
|
||||
Reference in New Issue
Block a user