First Commit

This commit is contained in:
marco
2026-09-03 15:34:28 -03:00
commit f97819e551
3005 changed files with 487818 additions and 0 deletions
+133
View File
@@ -0,0 +1,133 @@
import asyncio
import sys
import os
sys.path.insert(0, "/home/marco/MonicaAgentIA/app")
os.environ["TELEGRAM_BOT_TOKEN"] = "test"
os.environ["TELEGRAM_CHAT_ID"] = "123"
from monica_agent import (
veragendamento_command,
veruseragenda_command,
load_user_profile,
save_user_profile,
clear_all_data,
)
class FakeMessage:
def __init__(self, text):
self.text = text
self.chat_id = 7889499475
async def reply_text(self, text, **kwargs):
print(f"BOT RESPONSE: {text[:500]}")
class FakeUpdate:
def __init__(self, text):
self.message = FakeMessage(text)
self.effective_chat = self
self.effective_user = self
self.effective_message = self.message
@property
def id(self):
return self.message.chat_id
@property
def username(self):
return "test_user"
@property
def first_name(self):
return "Marco"
class FakeContext:
def __init__(self):
self.bot = self
async def send_message(self, **kwargs):
print(f"BOT SEND: {kwargs.get('text', '')[:500]}")
async def test_veragendamento_not_configured():
print("=== Testando /veragendamento sem configuração ===")
profile = load_user_profile()
profile["proactive_schedule"] = {"enabled": False}
save_user_profile(profile)
update = FakeUpdate("/veragendamento")
context = FakeContext()
try:
await veragendamento_command(update, context)
print("✅ veragendamento_command executou sem erros")
except Exception as e:
print(f"❌ Erro: {e}")
import traceback
traceback.print_exc()
async def test_veragendamento_configured():
print("\n=== Testando /veragendamento com configuração ===")
profile = load_user_profile()
profile["proactive_schedule"] = {
"enabled": True,
"days": [0, 1, 2, 3, 4],
"start_time": "09:00",
"end_time": "22:00"
}
save_user_profile(profile)
update = FakeUpdate("/veragendamento")
context = FakeContext()
try:
await veragendamento_command(update, context)
print("✅ veragendamento_command executou sem erros")
except Exception as e:
print(f"❌ Erro: {e}")
import traceback
traceback.print_exc()
async def test_veruseragenda_not_configured():
print("\n=== Testando /veruseragenda sem configuração ===")
profile = load_user_profile()
profile["user_agenda"] = {}
save_user_profile(profile)
update = FakeUpdate("/veruseragenda")
context = FakeContext()
try:
await veruseragenda_command(update, context)
print("✅ veruseragenda_command executou sem erros")
except Exception as e:
print(f"❌ Erro: {e}")
import traceback
traceback.print_exc()
async def test_veruseragenda_configured():
print("\n=== Testando /veruseragenda com configuração ===")
profile = load_user_profile()
profile["user_agenda"] = {
"acordar": "07:00",
"cafe_da_manha": "08:00",
"trabalho": "09:00",
"almoco": "12:00",
}
save_user_profile(profile)
update = FakeUpdate("/veruseragenda")
context = FakeContext()
try:
await veruseragenda_command(update, context)
print("✅ veruseragenda_command executou sem erros")
except Exception as e:
print(f"❌ Erro: {e}")
import traceback
traceback.print_exc()
async def main():
await test_veragendamento_not_configured()
await test_veragendamento_configured()
await test_veruseragenda_not_configured()
await test_veruseragenda_configured()
print("\n=== Todos os testes concluídos ===")
if __name__ == "__main__":
asyncio.run(main())