You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead, use:task.apply() for sync execution, mocking for isolation.
Full examples: See assets/api_test.py for TestCeleryTaskLogic, TestCeleryCanvas, TestSetTenantDecorator, TestBeatScheduling.
5. Fake Secrets (TruffleHog)
# BAD - TruffleHog flags these:api_key="sk-test1234567890T3BlbkFJtest1234567890"# GOOD - obviously fake:api_key="sk-fake-test-key-for-unit-testing-only"
6. Response Status Codes
Scenario
Code
Successful GET
200
Successful POST
201
Async operation (DELETE/scan trigger)
202
Sync DELETE
204
Validation error
400
Missing permission (RBAC)
403
RLS isolation / not found
404
Commands
cd api && poetry run pytest -x --tb=short
cd api && poetry run pytest -k "test_provider"cd api && poetry run pytest api/src/backend/api/tests/test_rbac.py