forked from lucadileo9/formazing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_test.sh
More file actions
197 lines (166 loc) Β· 6.3 KB
/
quick_test.sh
File metadata and controls
197 lines (166 loc) Β· 6.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
echo ""
echo "π§ͺ FORMAZING QUICK TEST RUNNER"
echo "==============================="
show_help() {
echo ""
echo "π‘ Uso: ./quick_test.sh [COMANDO]"
echo ""
echo "π― COMANDI PIΓ USATI:"
echo " unit - Test unitari (1.2s)"
echo " notion - Test NotionService (0.9s)"
echo " config - Verifica connessioni"
echo " workflow - Test workflow completo"
echo " send - Invio controllato con conferma"
echo ""
echo "π· TEST MICROSOFT TEAMS:"
echo " microsoft - Test Microsoft Service isolato"
echo " integration - Test integrazione Notion β Microsoft"
echo " teams - Suite completa test Microsoft"
echo ""
echo "π Per lista completa comandi: docs/testing/README.md"
echo ""
}
check_prerequisites() {
echo "π§ Setup ambiente..."
if [ ! -f ".env" ]; then
echo "β File .env non trovato!"
echo "π‘ Crea il file .env con TELEGRAM_BOT_TOKEN=your_token_here"
exit 1
fi
if [ ! -f "tests/config/test_telegram_groups.json" ]; then
echo "β File tests/config/test_telegram_groups.json non trovato!"
echo "π‘ Configura i gruppi Telegram di test"
exit 1
fi
if [ ! -f "tests/config/test_message_templates.yaml" ]; then
echo "β File tests/config/test_message_templates.yaml non trovato!"
echo "π‘ Configura i template messaggi di test"
exit 1
fi
}
if [ -z "$1" ]; then
show_help
exit 0
fi
check_prerequisites
case "$1" in
"check")
echo "β
Tutti i file di configurazione sono presenti"
echo "π Verifica ambiente Python..."
python3 -c "import pytest; print('β
pytest disponibile')" 2>/dev/null || {
echo "β pytest non installato"
echo "π‘ Installa con: pip install pytest"
exit 1
}
echo "π Ambiente configurato correttamente!"
;;
"unit")
echo "β‘ Test unitari (1.2s)..."
python3 -m pytest tests/unit/ -v
;;
"notion")
echo "ποΈ Test NotionService (0.9s)..."
python3 -m pytest tests/unit/notion/ -v
;;
"format")
echo "π¨ Test formattazione messaggi..."
python3 -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_formatter_preview_messages -s -v --tb=short
;;
"safe")
echo "π‘οΈ Test sicuri (no invio)..."
python3 -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_formatter_preview_messages -s -v --tb=short
;;
"interactive")
echo "π€ Test interattivi con conferme..."
python3 -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration -s -v --tb=short
;;
"training")
echo "π€ Test invio formazione (REALE)..."
python3 -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_send_training_notification_real -s -v --tb=short
;;
"feedback")
echo "π Test feedback (REALE)..."
python3 -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_send_feedback_notification_real -s -v --tb=short
;;
"bot")
echo "π€ Test bot (REALE 60s)..."
python3 -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_bot_commands_interactive -s -v --tb=short
;;
"real")
echo "π¨ Test tutti reali..."
read -p "β Continui? (s/N): " confirm
if [[ ! "$confirm" =~ ^[Ss]$ ]]; then
echo "βοΈ Annullato"
exit 0
fi
python3 -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration -m real_telegram -s -v --tb=short
;;
"config")
echo "οΏ½ Verifica connessioni..."
python3 tests/e2e/test_real_config.py
;;
"preview")
echo "π¨ Test formattazione con dati reali..."
python3 tests/e2e/test_real_formatting.py
;;
"send")
echo "π€ Test invio controllato..."
echo "β οΈ ATTENZIONE: PuΓ² inviare messaggi REALI dopo conferma!"
python3 tests/e2e/test_real_send.py
;;
"workflow")
echo "π Test workflow completo (safe)..."
python3 tests/e2e/test_workflow.py --limit 3
;;
"workflow-real")
echo "π Workflow reale..."
python3 tests/e2e/test_workflow.py --real --limit 2
;;
"microsoft")
echo "π· Test Microsoft Service (isolato)..."
python3 tests/e2e/test_real_microsoft.py
;;
"integration")
echo "π Test integrazione Notion β Microsoft..."
python3 tests/integration/test_notion_microsoft_integration.py
;;
"teams")
echo "π
Test completo Microsoft Teams..."
echo ""
echo "π Piano test Microsoft:"
echo " 1οΈβ£ Test service isolato (crea evento + email)"
echo " 2οΈβ£ Test integrazione Notion β Microsoft"
echo ""
read -p "β Esegui test isolato Microsoft? (s/N): " confirm1
if [[ "$confirm1" =~ ^[Ss]$ ]]; then
echo "π· Test Microsoft Service..."
python3 tests/e2e/test_real_microsoft.py
if [ $? -ne 0 ]; then
echo "β Test Microsoft fallito"
exit 1
fi
echo "β
Test Microsoft completato!"
echo ""
fi
read -p "β Esegui test integrazione Notion β Microsoft? (s/N): " confirm2
if [[ "$confirm2" =~ ^[Ss]$ ]]; then
echo "π Test integrazione..."
python3 tests/integration/test_notion_microsoft_integration.py
if [ $? -ne 0 ]; then
echo "β Test integrazione fallito"
exit 1
fi
echo "β
Test integrazione completato!"
fi
echo ""
echo "π Suite test Microsoft completata!"
;;
*)
echo "β Comando non riconosciuto: $1"
echo "π‘ Usa: ./quick_test.sh (senza parametri) per vedere l'help"
exit 1
;;
esac
echo ""
echo "β
Operazione completata"