main commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-16 16:30:25 +09:00
parent 91c7e04474
commit 537e7b363f
1146 changed files with 45926 additions and 77196 deletions

66
tests/simple_test.py Normal file
View File

@@ -0,0 +1,66 @@
#!/usr/bin/env python
import json
import sys
import requests
import traceback
from datetime import date
# API Gateway endpoint
BASE_URL = "http://localhost:8004"
def main():
try:
print("Начинаем тест мобильного эндпоинта...")
# Проверка работоспособности сервиса
print("Проверяем работоспособность сервиса...")
health_response = requests.get(f"{BASE_URL}/health")
print(f"Ответ о статусе: {health_response.status_code}")
print(f"Тело ответа: {health_response.text}")
# Данные в формате мобильного приложения
mobile_data = {
"date": date.today().isoformat(),
"type": "MENSTRUATION",
"flow_intensity": 3, # средний (1-5)
"symptoms": ["CRAMPS", "HEADACHE"], # массив строк
"mood": "NORMAL",
"notes": "Тестовая запись из мобильного приложения"
}
print(f"Отправляемые данные: {json.dumps(mobile_data, indent=2)}")
# Отправляем запрос к тестовому эндпоинту
print(f"Отправляем запрос на {BASE_URL}/debug/mobile-entry")
response = requests.post(
f"{BASE_URL}/debug/mobile-entry",
json=mobile_data
)
print(f"Статус ответа: {response.status_code}")
print(f"Заголовки ответа: {response.headers}")
try:
response_json = response.json()
print(f"Тело ответа: {json.dumps(response_json, indent=2)}")
except json.JSONDecodeError:
print(f"Ответ не является JSON: {response.text}")
if response.status_code >= 200 and response.status_code < 300:
print("Тест успешно завершен!")
else:
print("Тест завершился с ошибкой.")
sys.exit(1)
except requests.exceptions.ConnectionError:
print(f"Ошибка подключения к {BASE_URL}. Убедитесь, что сервис запущен.")
traceback.print_exc()
sys.exit(1)
except Exception as e:
print(f"Неожиданная ошибка: {e}")
traceback.print_exc()
sys.exit(1)
if __name__ == "__main__":
main()