def contains_message(response, message):
    """
    Inspired by django's self.assertRaisesMessage

    Useful for confirming the response contains the provided message,
    """
    if len(response.context['messages']) != 1:
        return False

    full_message = str(list(response.context['messages'])[0])

    return message in full_message