tests/test_middleware.py: Add more tests; increase coverage
tests/test_middleware.py: Add more tests; increase coverage (2)