""" Basic Unit Tests for Women's Safety App Backend """ import pytest from fastapi.testclient import TestClient def test_basic_health_check(): """Базовый тест работоспособности""" # Простая проверка что модули импортируются import fastapi import sqlalchemy import redis assert True # Если дошли сюда, то импорты работают def test_basic_functionality(): """Тест базовой функциональности""" from fastapi import FastAPI app = FastAPI() @app.get("/health") def health(): return {"status": "ok"} client = TestClient(app) response = client.get("/health") assert response.status_code == 200 assert response.json() == {"status": "ok"} def test_environment_variables(): """Тест переменных окружения""" import os # Проверяем что переменные окружения доступны database_url = os.getenv("DATABASE_URL") redis_url = os.getenv("REDIS_URL") jwt_secret = os.getenv("JWT_SECRET_KEY") assert database_url is not None assert redis_url is not None assert jwt_secret is not None def test_pydantic_models(): """Тест Pydantic моделей""" from pydantic import BaseModel class TestModel(BaseModel): name: str age: int model = TestModel(name="Test", age=25) assert model.name == "Test" assert model.age == 25 def test_password_hashing(): """Тест хеширования паролей""" from passlib.context import CryptContext pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") password = "testpassword123" hashed = pwd_context.hash(password) assert pwd_context.verify(password, hashed) assert not pwd_context.verify("wrongpassword", hashed)