docs: update README and add test infrastructure

- Enhance .gitignore with comprehensive Python patterns
- Improve README with better setup and testing instructions
- Add test infrastructure:
  * Test requirements file
  * Environment setup script
  * Test runner script
  * Comprehensive test suite
  * Coverage configuration
This commit is contained in:
2025-08-08 10:54:56 +02:00
parent 9e1f2128a2
commit 0e3311df8e
12 changed files with 840 additions and 14 deletions
+32 -13
View File
@@ -44,20 +44,26 @@ You can try out a live demo at [https://demo-oidc.cl1.parano.ch/](https://demo-o
cd oidc-validator
```
2. Install dependencies:
2. Set up virtual environment and install dependencies:
```bash
pip install -r requirements.txt
./setup_test_env.sh
```
3. Set environment variables:
3. Activate the virtual environment:
```bash
source venv/bin/activate
```
4. Set environment variables:
```bash
export CLIENT_ID=your_oidc_client_id
export CLIENT_SECRET=your_oidc_client_secret # Required for token refresh
```
4. Run the application:
5. Run the application:
```bash
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
@@ -118,17 +124,30 @@ The application can be configured using the following environment variables:
### Running Tests
Currently, there are no automated tests. You can manually test the endpoints using curl:
This project includes a comprehensive test suite. To run the tests:
```bash
# Health check
curl http://localhost:8000/health
1. Set up the virtual environment:
```bash
./setup_test_env.sh
```
# Token validation (requires valid JWT token)
curl -X POST http://localhost:8000/validate-token \
-H "Content-Type: application/json" \
-d '{"id_token": "your.jwt.token.here"}'
```
2. Run the tests:
```bash
./run_tests.sh
```
This will run all tests with coverage reporting and generate an HTML coverage report in the `htmlcov/` directory.
The test suite covers:
- API endpoint testing
- Token validation logic
- Error handling
- Utility functions
- Edge cases
For more detailed information about testing, see [tests/README.md](tests/README.md).
### Deployment Notes