From 8ac7263f3044891571afa63f741588cddfa3411d Mon Sep 17 00:00:00 2001 From: Max Chis Date: Wed, 3 Dec 2025 19:15:55 -0500 Subject: [PATCH] Add tests for new logic --- tests/test_app_init.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_app_init.py diff --git a/tests/test_app_init.py b/tests/test_app_init.py new file mode 100644 index 000000000..931b3d13c --- /dev/null +++ b/tests/test_app_init.py @@ -0,0 +1,19 @@ +"""Tests for initialization of FastAPI app instance.""" +import pytest + +from fastapi import FastAPI + + +def test_open_api_url_no_title(): + """An error should be raised if an openapi URL is provided without a title.""" + with pytest.raises(ValueError): + FastAPI(openapi_url="/openapi.json", title=None) + +def test_open_api_url_no_version(): + """An error should be raised if an openapi URL is provided without a version.""" + with pytest.raises(ValueError): + FastAPI(openapi_url="/openapi.json", version=None) + +def test_open_api_url_title_and_version(): + """No error should be raised if an openapi URL is provided with a title and version.""" + FastAPI(openapi_url="/openapi.json", title="Title", version="0.1") \ No newline at end of file