async def test_start_command(testbot: EvernoteBot, text_update): update = text_update start_cmd = StartCommand(testbot) await start_cmd.execute(update.message) await asyncio.sleep(0.0001) sessions = StartSession.find() assert len(sessions) == 1 assert sessions[0].id == update.message.user.id assert sessions[0].oauth_data['oauth_url'] == 'test_oauth_url' assert testbot.api.sendMessage.call_count == 1 args = testbot.api.sendMessage.call_args[0] assert len(args) == 4 assert 'Welcome' in args[1] assert testbot.api.editMessageReplyMarkup.call_count == 1
async def test_start_command(testbot: EvernoteBot, text_update: str): update = TelegramUpdate(json.loads(text_update)) start_cmd = StartCommand(testbot) await start_cmd.execute(update.message) await asyncio.sleep(0.0001) sessions = StartSession.find() assert len(sessions) == 1 assert sessions[0].id == update.message.user.id assert sessions[0].oauth_data['oauth_url'] == 'test_oauth_url' # TODO: # assert new_user.username == 'testuser' # assert new_user.first_name == 'test_first' # assert new_user.last_name == 'test_last' assert testbot.api.sendMessage.call_count == 1 args = testbot.api.sendMessage.call_args[0] assert len(args) == 3 assert 'Welcome' in args[1] assert testbot.api.editMessageReplyMarkup.call_count == 1