test(test_sqlalchemy_repository): Mocks repository method in unit test

Signed-off-by: -LAN- <laipz8200@outlook.com>
pull/19430/head
-LAN- 1 year ago
parent 79e1f74fc4
commit b306c7d6da
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF

@ -202,6 +202,9 @@ def test_get_db_models_by_workflow_run(repository, session, mocker: MockerFixtur
configure_mock_execution(mock_execution)
session_obj.scalars.return_value.all.return_value = [mock_execution]
# Mock the _to_domain_model method
to_domain_model_mock = mocker.patch.object(repository, "_to_domain_model")
# Call method
order_config = OrderConfig(order_by=["index"], order_direction="desc")
result = repository.get_db_models_by_workflow_run(workflow_run_id="test-workflow-run-id", order_config=order_config)
@ -215,8 +218,7 @@ def test_get_db_models_by_workflow_run(repository, session, mocker: MockerFixtur
assert result[0] is mock_execution
# Verify that _to_domain_model was NOT called (since we're returning raw DB models)
if hasattr(repository, "_to_domain_model"):
repository._to_domain_model.assert_not_called()
to_domain_model_mock.assert_not_called()
def test_get_running_executions(repository, session, mocker: MockerFixture):

Loading…
Cancel
Save