airajena opened a new pull request, #51:
URL: https://github.com/apache/fineract-business-intelligence/pull/51

   ## Superset dashboard asset logic : unit tests
   
   ### What changed
   
   - Extracted pure logic (`adhoc_metric`, `sql_filter`, `build_layout`, 
column/metric specs) out of `docker/superset/bootstrap_superset_assets.py` into 
a new `docker/superset/asset_specs.py`. No behavior change — 
`bootstrap_superset_assets.py` now imports from it. This was necessary because 
the original file does `from superset import db` and pushes an app context at 
module scope, making it unimportable outside the Superset container.
   - Added 25 unit tests across 3 files in `tests/unit/superset/`:
     - `test_asset_specs.py` — metric/filter shape, column dedup, PII guard 
(marts expose `client_hash`, never raw `client_id`), division-by-zero guards on 
ratio metrics.
     - `test_build_layout.py` — dashboard `position_json` structure: ROOT/GRID 
wiring, chart-to-row parent linkage, size override logic, error on unknown 
chart name.
     - `test_chart_params.py` — regression guards on chart params: Collection 
Efficiency KPI number format, non-empty KPI subheaders, `COUNT(DISTINCT 
client_hash)` (not `COUNT(*)`) on Repaying Borrowers KPI, PAR KPIs correctly 
filtered to the "All Portfolio" rollup row.
   - Wired into CI: `docker/superset/asset_specs.py` added to the syntax-check 
step, new `Unit tests - superset (no database)` step alongside the existing 
extractor one.
   
   ### Verification
   
   - All 96 unit tests pass locally (`pytest tests/unit -v`) — 71 extractor + 
25 Superset.
   
   ### Screenshot
   <img width="1886" height="796" alt="image" 
src="https://github.com/user-attachments/assets/60b8d83e-dc60-4007-8beb-c1bb7f50e911";
 />
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to