Write correct Flask tests -- app factory with test config, application context fixtures, database isolation, file uploads, auth testing, error handlers, mock.patch placement, and essential API test patterns
98
99%
Does it follow best practices?
Impact
97%
1.15xAverage score across 5 eval scenarios
Passed
No known issues
App context in fixture
25%
100%
Conftest fixture structure
64%
100%
Test config with TESTING=True
100%
100%
Database isolation per test
66%
100%
Auth tests both paths
100%
100%
Essential test patterns
100%
100%
Error response body checked
0%
0%
json= for POST requests
100%
100%
get_json() for responses
100%
100%
Run command documented
0%
100%
mock.patch targets import location
100%
100%
Mock args before fixture args
75%
100%
App context in fixture
100%
100%
SQLAlchemy test isolation
90%
100%
Auth fixture
100%
100%
Happy path checkout test
100%
100%
Payment failure test
100%
100%
Validation tests
75%
75%
Test config with TESTING=True
100%
100%
Email mock assertion
100%
100%
BytesIO file upload pattern
100%
100%
data= with content_type multipart
100%
100%
Valid and invalid file type tests
100%
100%
App context in fixture
50%
100%
Test config with TESTING=True
100%
100%
Auth via API key header
100%
100%
Auth both paths tested
100%
100%
Owner-only access tested
100%
100%
Conftest fixture structure
100%
100%
Database isolation per test
100%
100%
App context in fixture
35%
100%
Auth client fixture
0%
100%
Auth both paths tested
100%
100%
SQLAlchemy test isolation
100%
100%
Test config with TESTING=True
100%
100%
Conftest fixture structure
70%
100%
Authorization tests (author only)
100%
100%
Essential test patterns
100%
100%
json= for POST and get_json() for response
100%
100%
Run command documented
0%
0%
CLI test runner fixture
100%
100%
CLI command tests
100%
100%
Error handler body tested
100%
100%
App context in fixture
100%
100%
Conftest with app, client, runner
100%
100%
Database isolation per test
62%
100%
Auth both paths tested
100%
100%
Status transition validation
100%
100%
Admin-only delete tested
100%
100%
Test config with TESTING=True
100%
100%