示例#1
0
async def update_bot(bot: str,
                     request: TextData,
                     current_user: User = Depends(auth.get_current_user)):
    """
    Update name of the bot.
    """
    AccountProcessor.update_bot(request.data, bot)
    return {'message': 'Bot name updated'}
示例#2
0
 def test_update_bot_empty_name(self):
     with pytest.raises(AppException):
         AccountProcessor.update_bot(' ', '5f256412f98b97335c168ef0')
示例#3
0
 def test_update_bot_not_exists(self):
     with pytest.raises(AppException):
         AccountProcessor.update_bot('test_bot', '5f256412f98b97335c168ef0')
示例#4
0
 def test_update_bot_name(self):
     AccountProcessor.update_bot('test_bot', pytest.bot)
     bot = list(AccountProcessor.list_bots(pytest.account))
     assert bot[0]['name'] == 'test_bot'
     assert bot[0]['_id']