Exemplo n.º 1
0
def test_user_mention_with_args_no_object():
    """This function tests creating a user mention with a single argument and no Khoros object.

    .. versionadded:: 2.4.0

    :returns: None
    :raises: :py:exc:`khoros.errors.exceptions.MissingAuthDataError`
    """
    user_id, login = get_user_test_data()

    # Test with no login
    with pytest.raises(exceptions.MissingAuthDataError):
        messages.format_user_mention(user_id=user_id)

    # Test with no User ID
    with pytest.raises(exceptions.MissingAuthDataError):
        messages.format_user_mention(login=login)
    return
Exemplo n.º 2
0
def test_user_mention_with_dict_and_object():
    """This function tests creating a user mention with one key value pair and with a Khoros object.

    .. versionadded:: 2.4.0

    :returns: None
    """
    user_id, login = get_user_test_data()
    user_info_id = {'id': user_id}
    user_info_login = {'login': login}
    khoros = Khoros()

    # Test with no login
    response = messages.format_user_mention(khoros, user_info_id)
    assert expected_user_response(response)

    # Test with no User ID
    response = messages.format_user_mention(khoros, user_info_login)
    assert expected_user_response(response)
    return
Exemplo n.º 3
0
def test_user_mention_with_dictionary_no_object():
    """This function tests creating a user mention with a single key value pair and no Khoros object.

    .. versionadded:: 2.4.0

    :returns: None
    :raises: :py:exc:`khoros.errors.exceptions.MissingAuthDataError`
    """
    user_id, login = get_user_test_data()
    user_info_id = {'id': user_id}
    user_info_login = {'login': login}

    # Test with no login
    with pytest.raises(exceptions.MissingAuthDataError):
        messages.format_user_mention(user_info=user_info_id)

    # Test with no User ID
    with pytest.raises(exceptions.MissingAuthDataError):
        messages.format_user_mention(user_info=user_info_login)
    return
Exemplo n.º 4
0
def test_user_mention_with_arguments():
    """This function tests creating a user mention with all required arguments provided.

    .. versionadded:: 2.4.0

    :returns: None
    """
    user_id, login = get_user_test_data()
    response = messages.format_user_mention(user_id=user_id, login=login)
    assert expected_user_response(response)
    return
Exemplo n.º 5
0
def test_user_mention_with_dictionary():
    """This function tests creating a user mention with all required dictionary key value pairs provided.

    .. versionadded:: 2.4.0

    :returns: None
    """
    user_id, login = get_user_test_data()
    user_info = {'id': user_id, 'login': login}
    response = messages.format_user_mention(user_info=user_info)
    assert expected_user_response(response)
    return