Squash everything befor release.
Some past commits might have contained Cursor's IP or accidentally commited API keys. Before making the repository public, all the history has been squashed into a single commit with.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
"""Tests for the app."""
|
||||
@@ -0,0 +1,27 @@
|
||||
"""Defines fixtures available to all tests."""
|
||||
|
||||
import logging
|
||||
|
||||
import pytest
|
||||
from webtest import TestApp
|
||||
|
||||
from app import create_app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app():
|
||||
"""Create application for the tests."""
|
||||
_app = create_app("tests.settings")
|
||||
_app.logger.setLevel(logging.CRITICAL)
|
||||
ctx = _app.test_request_context()
|
||||
ctx.push()
|
||||
|
||||
yield _app
|
||||
|
||||
ctx.pop()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def testapp(app):
|
||||
"""Create Webtest app."""
|
||||
return TestApp(app)
|
||||
@@ -0,0 +1 @@
|
||||
"""Factories to help in tests."""
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Settings module for test app."""
|
||||
|
||||
ENV = "development"
|
||||
TESTING = True
|
||||
|
||||
SERVICE_API_KEY = "test-service-api-key"
|
||||
|
||||
AZURE_API_VERSION = "2025-04-01-preview"
|
||||
AZURE_BASE_URL = "test-base-url"
|
||||
AZURE_API_KEY = "test-api-key"
|
||||
AZURE_DEPLOYMENT = "gpt-5"
|
||||
AZURE_SUMMARY_LEVEL = "detailed"
|
||||
AZURE_TRUNCATION = "auto"
|
||||
|
||||
RECORD_TRAFFIC = False
|
||||
|
||||
|
||||
AZURE_RESPONSES_API_URL = (
|
||||
f"{AZURE_BASE_URL}/openai/responses?api-version={AZURE_API_VERSION}"
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
"""Functional tests using WebTest.
|
||||
|
||||
See: http://webtest.readthedocs.org/
|
||||
"""
|
||||
|
||||
|
||||
class TestConfig:
|
||||
"""Config."""
|
||||
|
||||
def test_config_is_set(self, testapp):
|
||||
"""Ensure required config values are set."""
|
||||
app = testapp.app
|
||||
assert app.config["AZURE_BASE_URL"] != "change_me"
|
||||
assert app.config["AZURE_API_KEY"] != "change_me"
|
||||
|
||||
|
||||
class TestModels:
|
||||
"""Models."""
|
||||
|
||||
def test_models_endpoint_returns_200(self, testapp):
|
||||
"""Ensure /models endpoint returns HTTP 200."""
|
||||
testapp.get("/models", status=401)
|
||||
|
||||
def test_health_endpoint_returns_200(self, testapp):
|
||||
"""Ensure /health endpoint returns HTTP 200."""
|
||||
testapp.get("/health", status=200)
|
||||
Reference in New Issue
Block a user