9c7f2bde11
Swap the Bootstrap CDN for a self-hosted Tailwind CSS build, mirroring the myice setup: standalone Tailwind CLI v3.4.17, a one-off build-css.sh script, and a gitignored generated style.css. - Add tailwind.config.js, style-input.css, build-css.sh at repo root - Rewrite templates/index.html: drop Bootstrap link/script, link /style.css, convert all classes to Tailwind utilities; showAlert now uses a class lookup so the JIT scanner detects dynamic classes - Add /style.css FileResponse route in main.py; drop cdn.jsdelivr.net from script-src/style-src in the CSP - Flip test assertion to assert cdn.jsdelivr.net is absent from CSP The generated style.css and tailwindcss binary are gitignored; run ./build-css.sh to regenerate (or --watch for dev).
Testing
This directory contains tests for the OIDC validator application.
Setup
Using the setup script (recommended)
- Run the setup script:
./setup_test_env.sh
This will create a virtual environment and install all dependencies.
Manual setup
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install application dependencies:
pip install -r requirements.txt -
Install test dependencies:
pip install -r requirements-test.txt
Running Tests
Using the test runner script (recommended)
./run_tests.sh
This will automatically activate the virtual environment and run the tests.
Manual execution
-
Activate the virtual environment:
source venv/bin/activate -
Run tests:
# Run all tests pytest # Run tests with coverage (excluding tests directory) pytest --cov=. --cov-config=.coveragerc # Run tests with verbose output pytest -v -
Deactivate the virtual environment when done:
deactivate
Coverage Reports
The test suite generates coverage reports to help you understand how well the code is tested:
- Terminal coverage report is displayed after running tests
- HTML coverage report is generated in the
htmlcov/directory - The coverage configuration excludes the tests directory itself from coverage statistics
Test Structure
conftest.py: Contains pytest fixtures shared across teststest_main.py: Tests for the main FastAPI application endpointstest_token_validation.py: Tests for token validation and refresh logictest_utils.py: Tests for utility functions
Test Coverage
The tests cover:
- Health check endpoint
- Token validation endpoint
- Token refresh endpoint
- Client configuration endpoint
- Utility functions for OIDC operations
- Error handling for various failure scenarios
- Edge cases and invalid inputs