about summary refs log tree commit diff
path: root/test/bnw_http_tests.py
AgeCommit message (Collapse)Author
2026-10-03validate the GN2 payload before prep; informative failures throughoutPjotr
Found by an exhaustive small-payload fuzz (test/fuzz_bnw.py): - bn_genenet.php: fail fast with a plain-English problem list for header-only payloads, ragged rows, single variable/sample, all-NA columns and all-NA rows, non-numeric cells and empty payloads; normalize CRLF and squeeze redundant row separators; rename duplicate variable names with a note (prep used to crash on each of these deep inside octave) - runtime_check.php: exe_time no longer fatals ("int + string") when prep did not produce its tables; falls back to a default estimate - execute_bn_gom.php: the FAILED page gains plain-English hints for the recurring octave failure modes - test/bnw_http_tests.py: tests t22-t33 lock the behaviour in - test/fuzz_bnw.py: the parameter-space fuzzer (75 cases)
2026-10-03bn_genenet: sanitize GN2 trait names containing spacesPjotr
GN2 trait display names often contain spaces ("Age at death"), but BNW's file format does not allow them: the octave parsers split on WHITESPACE (strtok), so a spaced name corrupts the header -- the variable count no longer matches the labels and structure learning dies with "A(0,_): subscripts must be either integers 1 to (2^63)-1 or logicals" in mk_adj_mat (observed on production with a real GN2 dataset). bn_genenet.php now sanitizes the NAME ROW of the GN2 payload (content before the first semicolon, i.e. before the comma->tab conversion): whitespace inside a name becomes an underscore. A wrong first attempt applied the sanitization after the conversion and collapsed the tabs as well, merging all names into one variable. New test t21 posts spaced trait names and runs structure learning through to the rendered SVG. Suite: 27/27 (BNW_LOCAL_SOURCE build).
2026-10-03bn_genenet: accept the GN2 template spelling My_GenenetPjotr
GN2's bnw_page.html posts the payload field as "My_Genenet" (one 'n' in Genenet), while BNW historically read "My_Gennenet" -- the two never matched, so GN2's POST arrived empty and BNW showed its default form (the "Loading data from GeneNetwork" hang). Accept both spellings. New test t18b posts My_Genenet through the legacy /sourcecodes/ action path the template uses. Suite with BNW_LOCAL_SOURCE (this checkout): 26/26.
2026-09-27test: t18 now asserts the server-side GN2 conversion (no JS echo)Pjotr
With the XSS fix the My_Gennenet POST returns the prepared-data page in one request; t18 asserts that and that the genenetwork_data JS echo is gone. 25/25.
2026-09-27test: emulate the GeneNetwork (GN2) handshake over HTTPPjotr
GN2 posts My_Gennenet to bn_genenet.php (commas = columns, semicolons = rows); the page converts it client-side to TSV in the hidden searchkey field and auto-submits. The new tests cover the entry point (t18: payload embedded in genenetwork_data() + auto-submit stub), the browserless emulation of the conversion (t19: searchkey/ My_key/MyUpload=NO posted directly, data prepared), and a full GN2 driven structure learning + rendering (t20). 25 checks pass via test/run_container_tests.sh.
2026-09-27test: catch the layout_svg_no data1=false failure mode and asset downloadsPjotr
Strengthen the example-workflow test: layout_svg_no.php must embed the real SVG ('var data1 = ['), never 'var data1 = false' (the json_encode(file(...)) failure that crashes the page with 'data1.join is not a function' in the browser). Add checks for the rendered SVG being downloadable via /bnw-data/ and for the page script assets (d3.v4.min.js, jquery, font-awesome, accordion, create_table.js) downloading with real content. 22 checks pass.
2026-09-27test: cover all six workflow.php examples (20 checks)Pjotr
Parametrize the example test over every example.php link on workflow.php (example2, example_sci, example_chr2_spleen, example_chl, example_time_series, examplecar15node): each loads the pre-computed example state into a fresh key and renders its network via layout_svg_no.php. All 20 checks pass.
2026-09-27test: add HTTP functional tests and tool checklistPjotr
test/bnw_http_tests.py drives a running BNW over plain HTTP requests (no headless browser): static pages, key handling, upload + octave input preparation, structure learning, network rendering and the worked examples from workflow.php, for both a discrete (8-node) and a continuous (5-node) dataset. 15 checks, all passing against the Guix container build of the upgraded tree. test/check_container_tools.sh verifies every unix tool called externally (octave, dot, python3, the compiled scoring binaries, coreutils glue) exists in the deployment environment. README documents the test suite, the external tool inventory and the PHP8/container issues the tests uncovered (mixed /tmp/bnw and /var/lib/genenet/bnw data dirs, home.php redirect stub, broken keyval_error redirect, hardcoded python path).