TruthStack Test Suite

Comprehensive API testing for MSME lending verification platform

97.9% Pass Rate (47/48)

Quick Start

1. Start API Server

cd /path/to/truthstack3.0
uvicorn app.main:app --host 0.0.0.0 --port 8100 --reload

2. Run Tests (Web UI)

cd /path/to/truthstack-test-suite
python -c "from app import app; app.run(debug=True, port=5001)"

Open: http://localhost:5001

Command Line

python tests/run_all_tests.py

Test Suites

SuiteEpicDescription
test_00_lender_onboardingE00Lender registration
test_01_authenticationE00OAuth2 tokens
test_02_applicationsE01/E14Application CRUD
test_03_documentsE01Document upload
test_04_connectionsE05GST/AA/MCA connections
test_05_readinessE01ACK/NACK checks
test_06_submitE01Application submission
test_07_health-Health probes
test_08_verificationE03-E08RATF verification
test_09_executionE09RRP generation
test_15_psb_platformE15PSB Xchange
test_16_invoice_screeningE16Duplicate screening
test_17_consortiumE17Fraud consortium
test_18_scf_productsE18SCF products
test_19_batch_operationsE19Batch verification
test_20_analyticsE20Platform analytics

Running Specific Suites

# Run only authentication tests
python tests/run_all_tests.py --suite auth

# Run PSB Platform tests
python tests/run_all_tests.py --suite psb-platform

# Available suites:
#   onboarding, auth, apps, docs, gst, readiness, submit,
#   health, verify, execution, psb-platform, invoice-screening,
#   consortium, scf-products, batch-operations, analytics

Authentication Flow

The test suite uses OAuth2 Client Credentials flow:

Step 1: Register Lender

curl -X POST http://localhost:8100/api/v3/lenders \
  -H "Content-Type: application/json" \
  -d '{"legal_name": "Test Finance Pvt Ltd", "lender_type": "nbfc", ...}'

Step 2: Generate API Keys

curl -X POST http://localhost:8100/api/v3/auth/keys \
  -H "Content-Type: application/json" \
  -d '{"lender_id": "<lender_id>"}'

Step 3: Get Access Token

curl -X POST http://localhost:8100/api/v3/auth/token \
  -d "grant_type=client_credentials" \
  -d "client_id=<client_id>" \
  -d "client_secret=<client_secret>"

Step 4: Use Token

curl -X GET http://localhost:8100/api/v3/applications \
  -H "Authorization: Bearer <access_token>"

Key Endpoints

EndpointMethodDescription
/api/v3/lendersPOSTRegister lender
/api/v3/auth/keysPOSTGenerate API credentials
/api/v3/auth/tokenPOSTGet access token
/api/v3/applicationsPOST/GETCreate/list applications
/api/v3/verifyPOSTRun verification
/api/v3/rrp/{id}GETGet verification report
/api/v3/verify/batchPOSTBatch verification
/healthGETHealth check

Links