calendar features
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-09-26 14:45:00 +09:00
parent b98034b616
commit 64171196b6
18 changed files with 2189 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
import requests
import json
def test_calendar_via_gateway():
# Используемый токен
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyOSIsImVtYWlsIjoidGVzdDJAZXhhbXBsZS5jb20iLCJleHAiOjE3NTg4NjQwMzV9.Ap4ZD5EtwhLXRtm6KjuFvXMlk6XA-3HtMbaGEu9jX6M"
# Базовый URL для API Gateway
base_url = "http://localhost:8000"
# Заголовки с авторизацией
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
print("Тестирование через API Gateway:")
print("Используемый токен:", token)
print("Заголовки:", headers)
try:
# Проверка /api/v1/calendar/entries через API Gateway
print("\nОтправка GET запроса на /api/v1/calendar/entries...")
response = requests.get(f"{base_url}/api/v1/calendar/entries", headers=headers)
print("GET /api/v1/calendar/entries через Gateway:", response.status_code)
if response.status_code == 200:
print("Response:", json.dumps(response.json(), indent=2)[:100] + "...")
else:
print("Error response:", response.text)
except Exception as e:
print("Ошибка при выполнении GET запроса:", str(e))
try:
# Проверка /api/v1/entry через API Gateway
entry_data = {
"date": "2023-11-15",
"type": "period",
"note": "Test entry",
"symptoms": ["cramps", "headache"],
"flow_intensity": "medium"
}
print("\nОтправка POST запроса на /api/v1/entry...")
print("Данные:", json.dumps(entry_data, indent=2))
response = requests.post(f"{base_url}/api/v1/entry", headers=headers, json=entry_data)
print("POST /api/v1/entry через Gateway:", response.status_code)
if response.status_code == 201 or response.status_code == 200:
print("Response:", json.dumps(response.json(), indent=2))
else:
print("Error response:", response.text)
except Exception as e:
print("Ошибка при выполнении POST запроса:", str(e))
if __name__ == "__main__":
test_calendar_via_gateway()