예제 #1
0
def on_users_callback(update: Update,
                      context: CallbackContext) -> None:  # pragma: no cover
    if str(update.message.chat_id) == config.ADMIN_CHAT_ID:
        users = list(dao.get_all_users())
        msg = utils.build_users_msg(users)
    else:
        msg = "Loitering around my github?\nDon't hesitate greeting me! 😀"
    update.message.reply_text(msg)
예제 #2
0
def test_build_users_msg():
    users = [{
        'name': 'romanito',
        'isActive': True,
        'chatId': 'aChatId'
    }, {
        'name': 'pinxulino',
        'isActive': False,
        'chatId': 'aChatId2'
    }]
    res = utils.build_users_msg(users)
    tc.assertEqual(
        res, "Users: (2)"
        "\n- aChatId romanito 😀"
        "\n- aChatId2 pinxulino 😴")
예제 #3
0
def test_build_users_msg():
    users = [{
        'name': 'romanito',
        'isActive': True,
        'chatId': 'aChatId'
    }, {
        'name': 'pinxulino',
        'isActive': False,
        'chatId': 'aChatId2',
        'levels': ['beginner', "intermediate"]
    }]
    res = utils.build_users_msg(users)
    tc.assertEqual(
        res, "Users: (2)"
        "\n- aChatId romanito 😀 "
        "\n- aChatId2 pinxulino 😴 bi")
예제 #4
0
 def callback_on_users(self, update: Update, context: CallbackContext) -> None:  # pragma: no cover
     users = list(self.dao.get_all_users())
     msg = utils.build_users_msg(users)
     update.message.reply_text(msg)