def test_get_action_success():
    """
    Tests the main response from get all actions
    """
    action_resource = ActionsIdResource()
    # stubs for db
    action_resource.get_action_db = actions_db
    action_resource.get_dag_run_db = dag_runs_db
    action_resource.get_tasks_db = tasks_db
    action_resource.get_validations_db = get_validations
    action_resource.get_action_command_audit_db = get_ac_audit

    action = action_resource.get_action('12345678901234567890123456')
    if action['name'] == 'dag_it':
        assert len(action['steps']) == 3
        assert action['dag_status'] == 'FAILED'
        assert len(action['command_audit']) == 2
def test_get_action_db(mock_get_action_by_id):
    expected = {
        'id': '12345678901234567890123456',
        'name': 'dag_it',
        'parameters': None,
        'dag_id': 'did2',
        'dag_execution_date': DATE_ONE_STR,
        'user': '******',
        'timestamp': DATE_ONE,
        'context_marker': '8-4-4-4-12a'
    }
    mock_get_action_by_id.return_value = expected
    action_resource = ActionsIdResource()
    action_id = 'test_action_id'

    result = action_resource.get_action_db(action_id)
    mock_get_action_by_id.assert_called_once_with(action_id=action_id)
    assert result == expected