Exemplo n.º 1
0
async def count_engaged_users(month: HistoryMonth = 1, current_user: User = Depends(auth.get_current_user)):

    """
    Fetches the number of engaged users of the bot
    """
    engaged_user_count, message = ChatHistory.engaged_users(
        current_user.get_bot(), month
    )
    return {"data": engaged_user_count, "message": message}
Exemplo n.º 2
0
async def count_engaged_users(request: ConversationFilter = ConversationFilter(), current_user: User = Depends(auth.get_current_user_and_bot)):

    """
    Fetches the number of engaged users of the bot
    """
    engaged_user_count, message = ChatHistory.engaged_users(
        current_user.get_bot(), request.month, request.engaged_users_threshold
    )
    return {"data": engaged_user_count, "message": message}
Exemplo n.º 3
0
 def test_engaged_users(self, mock_mongo_client):
     engaged_user, message = ChatHistory.engaged_users("tests")
     assert engaged_user['engaged_users'] == 0
     assert message is None
Exemplo n.º 4
0
 def test_engaged_users_error(self, mock_mongo_processor):
     with pytest.raises(Exception):
         engaged_user, message = ChatHistory.engaged_users("tests")
         assert not engaged_user
         assert message is None