From c62f54d6a91912817ee960d42c6c11178aa6edc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Thu, 19 Sep 2024 22:03:54 -0700 Subject: [PATCH 1/9] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 90f7561..2c167bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ Flask==3.0.3 -pyxform==2.0.3 -gunicorn==22.0.0 +pyxform==2.1.0 +gunicorn==23.0.0 From afab1e8d4930227385d5ac7c22d0d740ee25652d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Fri, 20 Sep 2024 05:09:01 +0000 Subject: [PATCH 2/9] Update tests --- test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index b8de17f..19cc97f 100755 --- a/test.sh +++ b/test.sh @@ -34,7 +34,7 @@ if [ "$test_3_actual" != "$test_3_expected" ]; then fi test_4_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback: validate-error" --data-binary @test/validate-error.xlsx http://127.0.0.1:5001/api/v1/convert) -test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser. See above for a hint.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}.xml\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' +test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}.xml\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' if [ "$test_4_actual" != "$test_4_expected" ]; then echo "test 4 failed: form that passes pyxform's internal checks, but fails ODK Validate's checks" test_failed="true" @@ -44,6 +44,7 @@ test_5_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback test_5_expected='{"error":null,"itemsets":"\"list_name\",\"name\",\"label\",\"province\",\"district\"\n\"districts\",\"district_a\",\"District A (in Province 1)\",\"province_1\",\"None\"\n\"districts\",\"district_b\",\"District B (in Province 1)\",\"province_1\",\"None\"\n\"districts\",\"district_c\",\"District C (in Province 2)\",\"province_2\",\"None\"\n\"None\",\"None\",\"None\",\"None\",\"None\"\n\"lots\",\"lot_10\",\"Lot 10 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_20\",\"Lot 20 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_30\",\"Lot 30 (In District B)\",\"province_1\",\"district_b\"\n\"lots\",\"lot_40\",\"Lot 40 (In District C)\",\"province_2\",\"district_c\"\n","result":"external-choicesprovince_1province_2","status":200,"warnings":[]}' if [ "$test_5_actual" != "$test_5_expected" ]; then echo "test 5 failed: form that converts (with external choices)" + echo "$test_5_actual" test_failed="true" fi From 9b32a80a7e92794121d74a5ecdfb0b2064b10f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Fri, 20 Sep 2024 05:25:01 +0000 Subject: [PATCH 3/9] Update tests --- test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 19cc97f..429384a 100755 --- a/test.sh +++ b/test.sh @@ -37,11 +37,12 @@ test_4_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}.xml\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' if [ "$test_4_actual" != "$test_4_expected" ]; then echo "test 4 failed: form that passes pyxform's internal checks, but fails ODK Validate's checks" + echo "$test_4_actual" test_failed="true" fi test_5_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback: external-choices" --data-binary @test/external-choices.xlsx http://127.0.0.1:5001/api/v1/convert) -test_5_expected='{"error":null,"itemsets":"\"list_name\",\"name\",\"label\",\"province\",\"district\"\n\"districts\",\"district_a\",\"District A (in Province 1)\",\"province_1\",\"None\"\n\"districts\",\"district_b\",\"District B (in Province 1)\",\"province_1\",\"None\"\n\"districts\",\"district_c\",\"District C (in Province 2)\",\"province_2\",\"None\"\n\"None\",\"None\",\"None\",\"None\",\"None\"\n\"lots\",\"lot_10\",\"Lot 10 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_20\",\"Lot 20 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_30\",\"Lot 30 (In District B)\",\"province_1\",\"district_b\"\n\"lots\",\"lot_40\",\"Lot 40 (In District C)\",\"province_2\",\"district_c\"\n","result":"external-choicesprovince_1province_2","status":200,"warnings":[]}' +test_5_expected='{"error":null,"itemsets":"\"list_name\",\"name\",\"label\",\"province\",\"district\"\n\"districts\",\"district_a\",\"District A (in Province 1)\",\"province_1\"\n\"districts\",\"district_b\",\"District B (in Province 1)\",\"province_1\"\n\"districts\",\"district_c\",\"District C (in Province 2)\",\"province_2\"\n\n\"lots\",\"lot_10\",\"Lot 10 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_20\",\"Lot 20 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_30\",\"Lot 30 (In District B)\",\"province_1\",\"district_b\"\n\"lots\",\"lot_40\",\"Lot 40 (In District C)\",\"province_2\",\"district_c\"\n","result":"external-choicesprovince_1province_2","status":200,"warnings":[]}' if [ "$test_5_actual" != "$test_5_expected" ]; then echo "test 5 failed: form that converts (with external choices)" echo "$test_5_actual" From 6afb28ef088eb66099a75a87d452f5364b58df4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Fri, 20 Sep 2024 05:30:07 +0000 Subject: [PATCH 4/9] Update tests --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 429384a..cd61d3d 100755 --- a/test.sh +++ b/test.sh @@ -34,7 +34,7 @@ if [ "$test_3_actual" != "$test_3_expected" ]; then fi test_4_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback: validate-error" --data-binary @test/validate-error.xlsx http://127.0.0.1:5001/api/v1/convert) -test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}.xml\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' +test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field 'concat' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function 'concatx'\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function 'concatx'\n\t... 10 more\n\nThe following files failed validation:\n${tmpt56os9nz}\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' if [ "$test_4_actual" != "$test_4_expected" ]; then echo "test 4 failed: form that passes pyxform's internal checks, but fails ODK Validate's checks" echo "$test_4_actual" From 9e44f66a11fc070b5e329233fd88fa3f4aa4c6cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Fri, 20 Sep 2024 05:38:25 +0000 Subject: [PATCH 5/9] Update tests --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index cd61d3d..2c7b96a 100755 --- a/test.sh +++ b/test.sh @@ -34,7 +34,7 @@ if [ "$test_3_actual" != "$test_3_expected" ]; then fi test_4_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback: validate-error" --data-binary @test/validate-error.xlsx http://127.0.0.1:5001/api/v1/convert) -test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field 'concat' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function 'concatx'\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function 'concatx'\n\t... 10 more\n\nThe following files failed validation:\n${tmpt56os9nz}\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' +test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field 'concat' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function 'concatx'\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function 'concatx'\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' if [ "$test_4_actual" != "$test_4_expected" ]; then echo "test 4 failed: form that passes pyxform's internal checks, but fails ODK Validate's checks" echo "$test_4_actual" From ca48c08f70c573360eb3c85e9bc57817e164ab7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Fri, 20 Sep 2024 05:43:38 +0000 Subject: [PATCH 6/9] Update tests --- test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 2c7b96a..f850e87 100755 --- a/test.sh +++ b/test.sh @@ -34,7 +34,7 @@ if [ "$test_3_actual" != "$test_3_expected" ]; then fi test_4_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback: validate-error" --data-binary @test/validate-error.xlsx http://127.0.0.1:5001/api/v1/convert) -test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field 'concat' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function 'concatx'\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function 'concatx'\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' +test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' if [ "$test_4_actual" != "$test_4_expected" ]; then echo "test 4 failed: form that passes pyxform's internal checks, but fails ODK Validate's checks" echo "$test_4_actual" @@ -42,7 +42,7 @@ if [ "$test_4_actual" != "$test_4_expected" ]; then fi test_5_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback: external-choices" --data-binary @test/external-choices.xlsx http://127.0.0.1:5001/api/v1/convert) -test_5_expected='{"error":null,"itemsets":"\"list_name\",\"name\",\"label\",\"province\",\"district\"\n\"districts\",\"district_a\",\"District A (in Province 1)\",\"province_1\"\n\"districts\",\"district_b\",\"District B (in Province 1)\",\"province_1\"\n\"districts\",\"district_c\",\"District C (in Province 2)\",\"province_2\"\n\n\"lots\",\"lot_10\",\"Lot 10 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_20\",\"Lot 20 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_30\",\"Lot 30 (In District B)\",\"province_1\",\"district_b\"\n\"lots\",\"lot_40\",\"Lot 40 (In District C)\",\"province_2\",\"district_c\"\n","result":"external-choicesprovince_1province_2","status":200,"warnings":[]}' +test_5_expected='{"error":null,"itemsets":"\"list_name\",\"name\",\"label\",\"province\",\"district\"\n\"districts\",\"district_a\",\"District A (in Province 1)\",\"province_1\"\n\"districts\",\"district_b\",\"District B (in Province 1)\",\"province_1\"\n\"districts\",\"district_c\",\"District C (in Province 2)\",\"province_2\"\n\n\"lots\",\"lot_10\",\"Lot 10 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_20\",\"Lot 20 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_30\",\"Lot 30 (In District B)\",\"province_1\",\"district_b\"\n\"lots\",\"lot_40\",\"Lot 40 (In District C)\",\"province_2\",\"district_c\"\n","result":"external-choicesprovince_1province_2","status":200,"warnings":[]}' if [ "$test_5_actual" != "$test_5_expected" ]; then echo "test 5 failed: form that converts (with external choices)" echo "$test_5_actual" From fe784cbed7d0de4a17d0706c21cdd3d1f2b98e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Fri, 20 Sep 2024 05:46:05 +0000 Subject: [PATCH 7/9] Update tests --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index f850e87..22ea2c3 100755 --- a/test.sh +++ b/test.sh @@ -34,7 +34,7 @@ if [ "$test_3_actual" != "$test_3_expected" ]; then fi test_4_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback: validate-error" --data-binary @test/validate-error.xlsx http://127.0.0.1:5001/api/v1/convert) -test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' +test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}.xml\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' if [ "$test_4_actual" != "$test_4_expected" ]; then echo "test 4 failed: form that passes pyxform's internal checks, but fails ODK Validate's checks" echo "$test_4_actual" From 8493d52833baac5bf0c1977488e122ce1b9d6c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Fri, 20 Sep 2024 16:19:12 +0000 Subject: [PATCH 8/9] Update tests --- test.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 22ea2c3..12d4770 100755 --- a/test.sh +++ b/test.sh @@ -33,8 +33,9 @@ if [ "$test_3_actual" != "$test_3_expected" ]; then test_failed="true" fi -test_4_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback: validate-error" --data-binary @test/validate-error.xlsx http://127.0.0.1:5001/api/v1/convert) -test_4_expected='{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${validate-error}.xml\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' +# test removes tmp file name from actual and expected +test_4_actual=$(curl --silent --request POST --data-binary @test/validate-error.xlsx http://127.0.0.1:5001/api/v1/convert | sed 's/tmp[0-9a-z]\{8\}//g') +test_4_expected=$(echo '{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${}\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' | sed 's/tmp[0-9a-z]\{8\}//g') if [ "$test_4_actual" != "$test_4_expected" ]; then echo "test 4 failed: form that passes pyxform's internal checks, but fails ODK Validate's checks" echo "$test_4_actual" From bbfb58dc214de794846a163b644abab2b0f9842b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Fri, 20 Sep 2024 16:53:22 +0000 Subject: [PATCH 9/9] Don't print actual --- test.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/test.sh b/test.sh index 12d4770..7b6c42e 100755 --- a/test.sh +++ b/test.sh @@ -38,7 +38,6 @@ test_4_actual=$(curl --silent --request POST --data-binary @test/validate-error. test_4_expected=$(echo '{"error":"ODK Validate Errors:\n>> Something broke the parser.\nError evaluating field '\''concat'\'' (${concat}[1]): The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\nCaused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${concat}\nXPath evaluation: cannot handle function '\''concatx'\''\n\t... 10 more\n\nThe following files failed validation:\n${}\n\nResult: Invalid","itemsets":null,"result":null,"status":400,"warnings":null}' | sed 's/tmp[0-9a-z]\{8\}//g') if [ "$test_4_actual" != "$test_4_expected" ]; then echo "test 4 failed: form that passes pyxform's internal checks, but fails ODK Validate's checks" - echo "$test_4_actual" test_failed="true" fi @@ -46,7 +45,6 @@ test_5_actual=$(curl --silent --request POST --header "X-XlsForm-FormId-Fallback test_5_expected='{"error":null,"itemsets":"\"list_name\",\"name\",\"label\",\"province\",\"district\"\n\"districts\",\"district_a\",\"District A (in Province 1)\",\"province_1\"\n\"districts\",\"district_b\",\"District B (in Province 1)\",\"province_1\"\n\"districts\",\"district_c\",\"District C (in Province 2)\",\"province_2\"\n\n\"lots\",\"lot_10\",\"Lot 10 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_20\",\"Lot 20 (in District A)\",\"province_1\",\"district_a\"\n\"lots\",\"lot_30\",\"Lot 30 (In District B)\",\"province_1\",\"district_b\"\n\"lots\",\"lot_40\",\"Lot 40 (In District C)\",\"province_2\",\"district_c\"\n","result":"external-choicesprovince_1province_2","status":200,"warnings":[]}' if [ "$test_5_actual" != "$test_5_expected" ]; then echo "test 5 failed: form that converts (with external choices)" - echo "$test_5_actual" test_failed="true" fi