def assertHasAction(testCase, logger, actionType, succeeded, startFields=None,
                    endFields=None):
    if startFields is None:
        startFields = {}
    if endFields is None:
        endFields = {}
    actions = LoggedAction.ofType(logger.messages, actionType)
    testCase.assertTrue(actions, "No actions of type %s" % (actionType,))
    action = actions[0]
    testCase.assertEqual(action.succeeded, succeeded)
    assertContainsFields(testCase, action.startMessage, startFields)
    assertContainsFields(testCase, action.endMessage, endFields)
    return action
Assert that the given logger has an action of the given type, and the first
dataset/ETHPy150Open ClusterHQ/eliot/eliot/testing.py/assertHasAction