Files
service-finder/docs/test_scripts_inventory.md

186 lines
12 KiB
Markdown

# Test Scripts Inventory & Cleanup Audit
**Date:** 2026-06-05
**Author:** Roo (Fast Coder)
**Scope:** Root (`/opt/docker/dev/service_finder/`) and `backend/` directories
---
## Summary
This document provides a complete inventory of all test scripts, diagnostic scripts, patch scripts, and shell scripts found in the project root and `backend/` directories. Each script has been evaluated for usefulness and categorized for archival or retention.
---
## Root Directory Scripts
| # | File | Purpose | Verdict |
|---|------|---------|---------|
| 1 | `test_mvp.sh` | Bash-based MVP test: login, vehicle creation, org switch via curl | **Archive** — superseded by Python test scripts |
| 2 | `test_mvp.py` | Python MVP test: same flow as above via `requests` | **Archive** — one-time MVP validation |
| 3 | `test_catalog_filter.py` | Tests catalog filtering by `vehicle_class` via `AssetService` | **Active** — useful for catalog verification |
| 4 | `test_catalog_only.py` | Simpler catalog filter test via `AssetService` | **Archive** — duplicate of `test_catalog_filter.py` |
| 5 | `test_integration.py` | Integration test: login, catalog, vehicle registration via `TestClient` | **Active** — useful API smoke test |
| 6 | `test_onboard_fix.py` | Tests org onboard endpoint with `aiohttp` | **Archive** — one-time fix verification |
| 7 | `test_onboard_fix_v2.py` | v2 of onboard test with form-data login | **Archive** — superseded by v2, one-time use |
| 8 | `test_onboard_integration.py` | Integration test for onboard fix via `TestClient` | **Archive** — one-time fix verification |
| 9 | `sf_gitea.sh` | Gitea manager wrapper script | **Active** — useful utility |
| 10 | `sf_run.sh` | Docker exec wrapper for `sf_api` | **Active** — useful utility |
| 11 | `patch_auth_login.py` | Patches auth login endpoint with remember_me | **Archive** — one-time patch script |
| 12 | `patch_auth_service.py` | Patches auth service with shadow identity logic | **Archive** — one-time patch script |
| 13 | `patch_auth_service_fix.py` | Reverts shadow identity patch | **Archive** — one-time patch script |
| 14 | `patch_test.py` | Patches test_invitation_e2e.py with UUIDs | **Archive** — one-time patch script |
---
## Backend Directory Scripts (`backend/`)
### Test Scripts (test_*.py)
| # | File | Purpose | Verdict |
|---|------|---------|---------|
| 15 | `test_asset_e2e.py` | E2E asset test: creates users, org, vehicles via API | **Active** — useful E2E test |
| 16 | `test_asset_e2e_direct.py` | Direct DB + API asset test | **Archive** — duplicate of `test_asset_e2e.py` |
| 17 | `test_asset_e2e_fetch.py` | Asset fetch test with existing org members | **Archive** — variant of E2E test |
| 18 | `test_auth_e2e.py` | Auth E2E: registration, verification, login flow | **Active** — useful auth test |
| 19 | `test_auth_e2e_setup.py` | Sets up system parameters for auth tests | **Active** — useful setup script |
| 20 | `test_catalog_only.py` | Catalog filter test (duplicate of root version) | **Archive** — duplicate |
| 21 | `test_check_response.py` | Checks org switch response format | **Archive** — one-time debug |
| 22 | `test_complete_flow.py` | Comprehensive org switching + token refresh test | **Active** — useful flow test |
| 23 | `test_debug_switch.py` | Debug org switch error | **Archive** — one-time debug |
| 24 | `test_decode_token.py` | Decodes JWT to check scope_id | **Archive** — one-time debug |
| 25 | `test_email.py` | Tests email sending via configured provider | **Active** — useful email test |
| 26 | `test_final_verification.py` | Final verification of org switching flow | **Archive** — one-time verification |
| 27 | `test_flow_simple.sh` | Bash-based org switching flow test | **Archive** — superseded by Python tests |
| 28 | `test_i18n_implementation.py` | Tests i18n context management and middleware | **Active** — useful i18n test |
| 29 | `test_invitation_e2e.py` | E2E test for org invitation flow | **Active** — useful invitation test |
| 30 | `test_makes_filter.py` | Tests catalog makes filter via API | **Archive** — duplicate of catalog tests |
| 31 | `test_minimal_verification.py` | Minimal token refresh test | **Archive** — one-time verification |
| 32 | `test_schema_changes.py` | Checks DB schema for issue #179 columns | **Active** — useful schema audit |
| 33 | `test_token_debug.py` | Debug PATCH endpoint response | **Archive** — one-time debug |
| 34 | `test_token_refresh.py` | Tests token refresh on org switch | **Archive** — superseded by `test_complete_flow.py` |
| 35 | `test_token_refresh_simple.py` | Simpler token refresh test | **Archive** — superseded |
| 36 | `test_user55_api.py` | API test for User 55 endpoints | **Archive** — one-time user-specific test |
### Diagnostic Scripts (check_*.py)
| # | File | Purpose | Verdict |
|---|------|---------|---------|
| 37 | `check_asset_888.py` | Checks branch_id/catalog_id for TEST-888 asset | **Archive** — one-time debug |
| 38 | `check_branch.py` | Lists first 5 branches | **Archive** — one-time debug |
| 39 | `check_db.py` | Lists first 5 users and orgs | **Archive** — one-time debug |
| 40 | `check_user_scope.py` | Checks User 28 scope details | **Archive** — one-time debug |
| 41 | `check_vmd.py` | Checks Ford Focus VMD entries | **Archive** — one-time debug |
### Setup/Utility Scripts
| # | File | Purpose | Verdict |
|---|------|---------|---------|
| 42 | `complete_kyc_script.py` | Completes KYC for User 55 | **Archive** — one-time setup |
| 43 | `create_business_org.py` | Creates business org for User 55 | **Archive** — one-time setup |
| 44 | `create_business_via_api.py` | Creates business org via API for User 55 | **Archive** — one-time setup |
| 45 | `create_integration_session.py` | Creates integration_session.json | **Active** — useful for test setup |
| 46 | `create_vehicle_for_org.py` | Creates vehicle for Org 34 | **Archive** — one-time setup |
| 47 | `create_vehicle_via_api.py` | Creates vehicle via external API | **Archive** — one-time setup |
| 48 | `full_discovery_bot.py` | Seeds 200+ brands/models into DB | **Archive** — one-time seed |
| 49 | `get_token_for_user_29.py` | Generates JWT for User 29 | **Archive** — one-time debug |
| 50 | `manual_verification.py` | Manually verifies User 55 email | **Archive** — one-time fix |
| 51 | `raw_data_dump.py` | Dumps branches and assets from DB | **Active** — useful for data inspection |
| 52 | `trigger_auth_emails.py` | Triggers auth emails for debugging | **Active** — useful email debug |
| 53 | `verify_org_structure.py` | Verifies org structure for User 55 | **Archive** — one-time verification |
---
## Backend `tests/` Directory (`backend/tests/`)
| # | File | Purpose | Verdict |
|---|------|---------|---------|
| 54 | `e2e_smoke_test.py` | E2E smoke test for registration flow | **Active** — useful smoke test |
| 55 | `test_01_registration.py` | Ground Zero: registration endpoint test | **Active** — useful registration test |
| 56 | `test_04_business_onboarding.py` | Ground Zero: business onboarding test | **Active** — useful onboarding test |
| 57 | `test_credentials.json` | Test credentials data | **Active** — test data |
---
## Existing `tests/` Directory (`tests/`)
| # | File | Purpose | Verdict |
|---|------|---------|---------|
| 58 | `fire_drill_email.py` | Live email delivery verification via SendGrid | **Active** — useful email test |
| 59 | `sendgrid_live_test.py` | Direct SendGrid API test | **Active** — useful email test |
| 60 | `verify_auth_loop.py` | Auth endpoint simulation test | **Active** — useful auth test |
---
## Cleanup Plan
### Move to `tests/active/` (Keep — Useful for ongoing testing)
1. `test_catalog_filter.py` — catalog filtering verification
2. `test_integration.py` — API smoke test
3. `sf_gitea.sh` — Gitea manager wrapper
4. `sf_run.sh` — Docker exec wrapper
5. `backend/test_asset_e2e.py` — E2E asset test
6. `backend/test_auth_e2e.py` — Auth E2E test
7. `backend/test_auth_e2e_setup.py` — Auth setup
8. `backend/test_complete_flow.py` — Org switching flow
9. `backend/test_email.py` — Email test
10. `backend/test_i18n_implementation.py` — i18n test
11. `backend/test_invitation_e2e.py` — Invitation E2E
12. `backend/test_schema_changes.py` — Schema audit
13. `backend/create_integration_session.py` — Test setup
14. `backend/raw_data_dump.py` — Data inspection
15. `backend/trigger_auth_emails.py` — Email debug
16. `backend/tests/e2e_smoke_test.py` — Smoke test
17. `backend/tests/test_01_registration.py` — Registration test
18. `backend/tests/test_04_business_onboarding.py` — Onboarding test
19. `backend/tests/test_credentials.json` — Test data
### Move to `tests/archive/` with `.old` extension (Obsolete / One-time use)
1. `test_mvp.sh``tests/archive/test_mvp.sh.old`
2. `test_mvp.py``tests/archive/test_mvp.py.old`
3. `test_catalog_only.py``tests/archive/test_catalog_only.py.old`
4. `test_onboard_fix.py``tests/archive/test_onboard_fix.py.old`
5. `test_onboard_fix_v2.py``tests/archive/test_onboard_fix_v2.py.old`
6. `test_onboard_integration.py``tests/archive/test_onboard_integration.py.old`
7. `patch_auth_login.py``tests/archive/patch_auth_login.py.old`
8. `patch_auth_service.py``tests/archive/patch_auth_service.py.old`
9. `patch_auth_service_fix.py``tests/archive/patch_auth_service_fix.py.old`
10. `patch_test.py``tests/archive/patch_test.py.old`
11. `backend/test_asset_e2e_direct.py``tests/archive/test_asset_e2e_direct.py.old`
12. `backend/test_asset_e2e_fetch.py``tests/archive/test_asset_e2e_fetch.py.old`
13. `backend/test_catalog_only.py``tests/archive/test_catalog_only.py.old`
14. `backend/test_check_response.py``tests/archive/test_check_response.py.old`
15. `backend/test_debug_switch.py``tests/archive/test_debug_switch.py.old`
16. `backend/test_decode_token.py``tests/archive/test_decode_token.py.old`
17. `backend/test_final_verification.py``tests/archive/test_final_verification.py.old`
18. `backend/test_flow_simple.sh``tests/archive/test_flow_simple.sh.old`
19. `backend/test_makes_filter.py``tests/archive/test_makes_filter.py.old`
20. `backend/test_minimal_verification.py``tests/archive/test_minimal_verification.py.old`
21. `backend/test_token_debug.py``tests/archive/test_token_debug.py.old`
22. `backend/test_token_refresh.py``tests/archive/test_token_refresh.py.old`
23. `backend/test_token_refresh_simple.py``tests/archive/test_token_refresh_simple.py.old`
24. `backend/test_user55_api.py``tests/archive/test_user55_api.py.old`
25. `backend/check_asset_888.py``tests/archive/check_asset_888.py.old`
26. `backend/check_branch.py``tests/archive/check_branch.py.old`
27. `backend/check_db.py``tests/archive/check_db.py.old`
28. `backend/check_user_scope.py``tests/archive/check_user_scope.py.old`
29. `backend/check_vmd.py``tests/archive/check_vmd.py.old`
30. `backend/complete_kyc_script.py``tests/archive/complete_kyc_script.py.old`
31. `backend/create_business_org.py``tests/archive/create_business_org.py.old`
32. `backend/create_business_via_api.py``tests/archive/create_business_via_api.py.old`
33. `backend/create_vehicle_for_org.py``tests/archive/create_vehicle_for_org.py.old`
34. `backend/create_vehicle_via_api.py``tests/archive/create_vehicle_via_api.py.old`
35. `backend/full_discovery_bot.py``tests/archive/full_discovery_bot.py.old`
36. `backend/get_token_for_user_29.py``tests/archive/get_token_for_user_29.py.old`
37. `backend/manual_verification.py``tests/archive/manual_verification.py.old`
38. `backend/verify_org_structure.py``tests/archive/verify_org_structure.py.old`
---
## Statistics
- **Total scripts found:** 60
- **Active (keep in place or move to `tests/active/`):** 19
- **Archive (move to `tests/archive/` with `.old`):** 38
- **Already in `tests/` (keep in place):** 3