forked from cartsnitch/api
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae2fc15a5b | |||
| 23899f6c8d | |||
| 1805ff93cf | |||
| ba88fad48b | |||
| 0127c16d0b |
@@ -23,7 +23,12 @@ class Settings(BaseSettings):
|
|||||||
|
|
||||||
auth_service_url: str = "http://auth:3001"
|
auth_service_url: str = "http://auth:3001"
|
||||||
|
|
||||||
cors_origins: list[str] = ["http://localhost:3000", "https://cartsnitch.com"]
|
cors_origins: list[str] = [
|
||||||
|
"http://localhost:3000",
|
||||||
|
"https://cartsnitch.com",
|
||||||
|
"https://dev.cartsnitch.com",
|
||||||
|
"https://uat.cartsnitch.com",
|
||||||
|
]
|
||||||
|
|
||||||
receiptwitness_url: str = "http://receiptwitness:8001"
|
receiptwitness_url: str = "http://receiptwitness:8001"
|
||||||
stickershock_url: str = "http://stickershock:8002"
|
stickershock_url: str = "http://stickershock:8002"
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from fastapi import APIRouter, FastAPI
|
|||||||
|
|
||||||
from cartsnitch_api.auth.routes import router as auth_router
|
from cartsnitch_api.auth.routes import router as auth_router
|
||||||
from cartsnitch_api.cache import cache_client
|
from cartsnitch_api.cache import cache_client
|
||||||
from cartsnitch_api.database import dispose_engine
|
|
||||||
from cartsnitch_api.middleware.cors import add_cors_middleware
|
from cartsnitch_api.middleware.cors import add_cors_middleware
|
||||||
from cartsnitch_api.middleware.error_handler import add_error_handlers, add_error_monitor_middleware
|
from cartsnitch_api.middleware.error_handler import add_error_handlers, add_error_monitor_middleware
|
||||||
from cartsnitch_api.middleware.rate_limit import add_rate_limit_middleware
|
from cartsnitch_api.middleware.rate_limit import add_rate_limit_middleware
|
||||||
@@ -26,6 +25,7 @@ from cartsnitch_api.routes.user import router as user_router
|
|||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def lifespan(app: FastAPI):
|
async def lifespan(app: FastAPI):
|
||||||
|
from cartsnitch_api.database import dispose_engine
|
||||||
await cache_client.initialize()
|
await cache_client.initialize()
|
||||||
yield
|
yield
|
||||||
await cache_client.close()
|
await cache_client.close()
|
||||||
|
|||||||
+4
-2
@@ -177,8 +177,10 @@ async def _create_test_user_and_session(
|
|||||||
async with db_engine.begin() as conn:
|
async with db_engine.begin() as conn:
|
||||||
await conn.execute(
|
await conn.execute(
|
||||||
text(
|
text(
|
||||||
"INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) "
|
"INSERT INTO users (id, email, hashed_password, display_name, "
|
||||||
"VALUES (:id, :email, :hashed_password, :display_name, :email_verified, :created_at, :updated_at)"
|
"email_verified, created_at, updated_at) "
|
||||||
|
"VALUES (:id, :email, :hashed_password, :display_name, :email_verified, "
|
||||||
|
":created_at, :updated_at)"
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
"id": user_id,
|
"id": user_id,
|
||||||
|
|||||||
@@ -138,7 +138,8 @@ async def test_expired_session_rejected(client, db_engine):
|
|||||||
async with db_engine.begin() as conn:
|
async with db_engine.begin() as conn:
|
||||||
await conn.execute(
|
await conn.execute(
|
||||||
text(
|
text(
|
||||||
"INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) "
|
"INSERT INTO users (id, email, hashed_password, display_name, "
|
||||||
|
"email_verified, created_at, updated_at) "
|
||||||
"VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)"
|
"VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)"
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
"""Tests for Settings config, specifically the database_url env var fallback."""
|
"""Tests for Settings config, specifically the database_url env var fallback."""
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from cartsnitch_api.config import Settings
|
from cartsnitch_api.config import Settings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ class TestSessionValidation:
|
|||||||
async with db_engine.begin() as conn:
|
async with db_engine.begin() as conn:
|
||||||
await conn.execute(
|
await conn.execute(
|
||||||
text(
|
text(
|
||||||
"INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) "
|
"INSERT INTO users (id, email, hashed_password, display_name, "
|
||||||
|
"email_verified, created_at, updated_at) "
|
||||||
"VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)"
|
"VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)"
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"""Tests for rate limiting middleware."""
|
"""Tests for rate limiting middleware."""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user