Skip to content

Commit f9fced2

Browse files
authored
fix: converts redis dsn to string (#11)
1 parent 8133ed0 commit f9fced2

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

aind-smartsheet-service-server/src/aind_smartsheet_service_server/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]:
3434
"""Init cache and add to lifespan of app"""
3535
settings = get_settings()
3636
if settings.redis_url is not None:
37-
redis = from_url(settings.redis_url)
37+
redis = from_url(settings.redis_url.unicode_string())
3838
FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
3939
else:
4040
FastAPICache.init(InMemoryBackend(), prefix="fastapi-cache")

aind-smartsheet-service-server/tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import pytest
1010
from fastapi.testclient import TestClient
11+
from pydantic import RedisDsn
1112

1213
from aind_smartsheet_service_server.configs import get_settings
1314

@@ -63,7 +64,7 @@ def client_with_redis() -> Generator[TestClient, Any, None]:
6364

6465
settings = get_settings()
6566
settings_with_redis = settings.model_copy(
66-
update={"redis_url": "redis"}, deep=True
67+
update={"redis_url": RedisDsn("redis://example.com:1234")}, deep=True
6768
)
6869
with (
6970
patch(

0 commit comments

Comments
 (0)