Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN pip install uv

COPY pyproject.toml uv.lock* README.md /app/

RUN uv sync --extra dev --frozen
RUN uv sync --extra dev

ENV PATH="/app/.venv/bin:$PATH"

Expand Down
1 change: 0 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
- ./guard_agent:/app/guard_agent:z
- ./tests:/app/tests:z
- ./pyproject.toml:/app/pyproject.toml:z
- ./uv.lock:/app/uv.lock:z
depends_on:
redis:
condition: service_started
Expand Down
4 changes: 4 additions & 0 deletions tests/test_adapter_django.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import os

from django.conf import settings
from django.http import HttpRequest, JsonResponse
from django.test import Client
Expand All @@ -10,12 +12,14 @@

API_KEY = "test-api-key-1234567890"
PROJECT_ID = "test-project"
REDIS_URL = os.getenv("REDIS_URL") or "redis://localhost:6379"

settings.GUARD_SECURITY_CONFIG = SecurityConfig(
enable_agent=True,
agent_api_key=API_KEY,
agent_project_id=PROJECT_ID,
passive_mode=True,
redis_url=REDIS_URL,
)


Expand Down
5 changes: 5 additions & 0 deletions tests/test_adapter_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
unit tests for ``guard_agent/client.py``.
"""

import os
import warnings

import pytest
Expand All @@ -20,6 +21,8 @@

from guard_agent.models import AgentConfig

REDIS_URL = os.getenv("REDIS_URL") or "redis://localhost:6379"

pytestmark = pytest.mark.filterwarnings(
"ignore:coroutine .* was never awaited:RuntimeWarning"
)
Expand All @@ -46,6 +49,7 @@ def _build_app(self) -> Flask:
agent_api_key=self.API_KEY,
agent_project_id=self.PROJECT_ID,
passive_mode=True,
redis_url=REDIS_URL,
)
FlaskAPIGuard(app, config=config)

Expand Down Expand Up @@ -87,6 +91,7 @@ def test_deferred_init_app_pattern(self) -> None:
agent_api_key=self.API_KEY,
agent_project_id=self.PROJECT_ID,
passive_mode=True,
redis_url=REDIS_URL,
)
guard = FlaskAPIGuard()
app = Flask(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_logging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def test_console_handler_emits_only_without_host_handlers(self) -> None:
try:
setup_agent_logging()
handler = logging.getLogger(GUARD_AGENT_LOGGER_NAME).handlers[0]
assert handler.filter(make_record()) is True
assert handler.filter(make_record())
finally:
root.handlers = original_handlers

Expand Down
Loading