def assertJsonContains(jsonStr=None, key=None, message=None):
    """
    Assert that jsonStr contains key.

    :param jsonStr: Json as string
    :param key: Key to look for
    :param message: Failure message
    :raises: TestStepFail if key is not in jsonStr or
    if loading jsonStr to a dictionary fails or if jsonStr is None.
    """
    if jsonStr is not None:
        try:
            data = json.loads(jsonStr)
            if key not in data:
                raise TestStepFail(
                    format_message(message) if message is not None else "Assert: "
                                                                        "Key : %s is not "
                                                                        "in : %s" % (str(key),
                                                                                     str(jsonStr)))
        except (TypeError, ValueError) as e:
            raise TestStepFail(
                format_message(message) if message is not None else "Unable to parse json "+str(e))
    else:
        raise TestStepFail(
            format_message(message) if message is not None else "Json string is empty")
Assert that jsonStr contains key.

    :param jsonStr: Json as string
    :param key: Key to look for
    :param message: Failure message
    :raises: TestStepFail if key is not in jsonStr or
    if loading jsonStr to a dictionary fails or if jsonStr is None.