From 11a417170d37b7474701d3f9cb1d10151b8268c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20P=C3=A9rez?= Date: Thu, 22 Aug 2024 09:53:53 +0200 Subject: [PATCH] tests(plsql): add function getfeaturegeom in ud and setarcfusion in both --- test/plsql/ud/test_gw_fct_getfeaturegeom.sql | 27 ++++++++++++++++++++ test/plsql/ud/test_gw_fct_setarcfusion.sql | 12 ++++++--- test/plsql/ws/test_gw_fct_setarcfusion.sql | 11 +++++--- 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 test/plsql/ud/test_gw_fct_getfeaturegeom.sql diff --git a/test/plsql/ud/test_gw_fct_getfeaturegeom.sql b/test/plsql/ud/test_gw_fct_getfeaturegeom.sql new file mode 100644 index 0000000000..56cc85f64e --- /dev/null +++ b/test/plsql/ud/test_gw_fct_getfeaturegeom.sql @@ -0,0 +1,27 @@ +/* +This file is part of Giswater 3 +The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This version of Giswater is provided by Giswater Association +*/ +BEGIN; + +-- Suppress NOTICE messages +SET client_min_messages TO WARNING; + +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- Plan for 1 test +SELECT plan(1); + +-- Extract and test the "status" field from the function's JSON response +SELECT is ( + (gw_fct_getfeaturegeom($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, + "feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "feature_type": "arc", "ids": "[20608, 157]"}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_getfeaturegeom returns status "Accepted"' +); + +-- Finish the test +SELECT finish(); + +ROLLBACK; \ No newline at end of file diff --git a/test/plsql/ud/test_gw_fct_setarcfusion.sql b/test/plsql/ud/test_gw_fct_setarcfusion.sql index db9030c21f..e76e6c6f99 100644 --- a/test/plsql/ud/test_gw_fct_setarcfusion.sql +++ b/test/plsql/ud/test_gw_fct_setarcfusion.sql @@ -10,11 +10,17 @@ SET client_min_messages TO WARNING; SET search_path = "SCHEMA_NAME", public, pg_catalog; +-- Plan for 1 test SELECT plan(1); -SELECT ok(1=1, 'One equals one'); --- TODO --- gw_fct_setarcdivide +-- Extract and test the "status" field from the function's JSON response +SELECT is ( + (gw_fct_setarcfusion($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, + "feature":{"id":["82"]}, "data":{"filterFields":{}, "pageInfo":{}, "enddate":"2024-08-22", + "workcatId":"work1", "action_mode": 0}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_setcatalog returns status "Accepted"' +); -- Finish the test SELECT finish(); diff --git a/test/plsql/ws/test_gw_fct_setarcfusion.sql b/test/plsql/ws/test_gw_fct_setarcfusion.sql index d7723d240a..49cb2ddfbe 100644 --- a/test/plsql/ws/test_gw_fct_setarcfusion.sql +++ b/test/plsql/ws/test_gw_fct_setarcfusion.sql @@ -10,11 +10,16 @@ SET client_min_messages TO WARNING; SET search_path = "SCHEMA_NAME", public, pg_catalog; +-- Plan for 1 test SELECT plan(1); -SELECT ok(1=1, 'One equals one'); --- TODO --- gw_fct_setarcfusion +-- Extract and test the "status" field from the function's JSON response +SELECT is ( + (gw_fct_setarcfusion($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{"id":["113852"]}, "data":{"filterFields":{}, + "pageInfo":{}, "enddate":"2024-08-22", "workcatId":"work1", "action_mode": 0}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_setcatalog returns status "Accepted"' +); -- Finish the test SELECT finish();