Beispiel #1
0
def test_get_execution_outputs(mock_client_factory, execution_data_locations):
    mock_client = MagicMock()
    mock_client.get_execution_data = MagicMock(
        return_value=_execution_models.WorkflowExecutionGetDataResponse(
            execution_data_locations[0],
            execution_data_locations[1]
        )
    )
    mock_client_factory.return_value = mock_client

    m = MagicMock()
    type(m).id = PropertyMock(
        return_value=identifier.WorkflowExecutionIdentifier(
            "project",
            "domain",
            "name",
        )
    )

    inputs = engine.FlyteWorkflowExecution(m).get_outputs()
    assert len(inputs.literals) == 1
    assert inputs.literals['b'].scalar.primitive.integer == 2
    mock_client.get_execution_data.assert_called_once_with(
        identifier.WorkflowExecutionIdentifier("project", "domain", "name")
    )
Beispiel #2
0
def test_get_full_execution_inputs(mock_client_factory):
    mock_client = MagicMock()
    mock_client.get_execution_data = MagicMock(
        return_value=_execution_models.WorkflowExecutionGetDataResponse(
            None,
            None,
            _INPUT_MAP,
            _OUTPUT_MAP,
        )
    )
    mock_client_factory.return_value = mock_client

    m = MagicMock()
    type(m).id = PropertyMock(
        return_value=identifier.WorkflowExecutionIdentifier(
            "project",
            "domain",
            "name",
        )
    )

    inputs = engine.FlyteWorkflowExecution(m).get_inputs()
    assert len(inputs.literals) == 1
    assert inputs.literals["a"].scalar.primitive.integer == 1
    mock_client.get_execution_data.assert_called_once_with(
        identifier.WorkflowExecutionIdentifier("project", "domain", "name")
    )