From ede26c46cec8a2e16822ba59057d5534e7f04dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20P=C3=A9rez?= Date: Thu, 22 Aug 2024 15:14:23 +0200 Subject: [PATCH] tests(plsql): add new test functions in ud --- .../ud/test_gw_fct_setfeaturereplaceplan.sql | 27 +++++++++++++++++++ .../ws/test_gw_fct_getcatfeaturevalues.sql | 27 +++++++++++++++++++ .../ws/test_gw_fct_gettypeahead copy.sql | 27 +++++++++++++++++++ test/plsql/ws/test_gw_fct_gettypeahead.sql | 2 +- .../ws/test_gw_fct_setfeaturereplaceplan.sql | 27 +++++++++++++++++++ 5 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 test/plsql/ud/test_gw_fct_setfeaturereplaceplan.sql create mode 100644 test/plsql/ws/test_gw_fct_getcatfeaturevalues.sql create mode 100644 test/plsql/ws/test_gw_fct_gettypeahead copy.sql create mode 100644 test/plsql/ws/test_gw_fct_setfeaturereplaceplan.sql diff --git a/test/plsql/ud/test_gw_fct_setfeaturereplaceplan.sql b/test/plsql/ud/test_gw_fct_setfeaturereplaceplan.sql new file mode 100644 index 0000000000..0364fafb8e --- /dev/null +++ b/test/plsql/ud/test_gw_fct_setfeaturereplaceplan.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_setfeaturereplaceplan($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, + "feature":{"featureType":"ARC", "ids":["20603"]}, "data":{"filterFields":{}, "pageInfo":{}, "catalog":"VIRTUAL"}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_setfeaturereplaceplan returns status "Accepted"' +); + +-- Finish the test +SELECT finish(); + +ROLLBACK; \ No newline at end of file diff --git a/test/plsql/ws/test_gw_fct_getcatfeaturevalues.sql b/test/plsql/ws/test_gw_fct_getcatfeaturevalues.sql new file mode 100644 index 0000000000..e90f1240f4 --- /dev/null +++ b/test/plsql/ws/test_gw_fct_getcatfeaturevalues.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_getcatfeaturevalues($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, + "form":{}, "feature":{}, "data":{"filterFields":{}, "pageInfo":{}}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_getcatfeaturevalues returns status "Accepted"' +); + +-- Finish the test +SELECT finish(); + +ROLLBACK; \ No newline at end of file diff --git a/test/plsql/ws/test_gw_fct_gettypeahead copy.sql b/test/plsql/ws/test_gw_fct_gettypeahead copy.sql new file mode 100644 index 0000000000..45aead2332 --- /dev/null +++ b/test/plsql/ws/test_gw_fct_gettypeahead copy.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_getstylemapzones($${"client":{"device":4, "lang":"es_ES", "infoType":1}, "form":{}, + "feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "mapzones":""}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_getstylemapzones returns status "Accepted"' +); + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_gw_fct_gettypeahead.sql b/test/plsql/ws/test_gw_fct_gettypeahead.sql index f522999b8e..94ea72d1fc 100644 --- a/test/plsql/ws/test_gw_fct_gettypeahead.sql +++ b/test/plsql/ws/test_gw_fct_gettypeahead.sql @@ -19,7 +19,7 @@ SELECT is ( "data":{"filterFields":{}, "pageInfo":{}, "queryText":"SELECT id, id as idval FROM cat_arc WHERE id IS NOT NULL AND active IS TRUE ", "queryTextFilter":" AND arctype_id", "parentId":"arc_type", "parentValue":"PIPE", "textToSearch":"PELD110-PN10"}}$$)::JSON)->>'status', 'Accepted', - 'Check if gw_fct_getcatfeaturevalues returns status "Accepted"' + 'Check if gw_fct_gettypeahead returns status "Accepted"' ); -- Finish the test diff --git a/test/plsql/ws/test_gw_fct_setfeaturereplaceplan.sql b/test/plsql/ws/test_gw_fct_setfeaturereplaceplan.sql new file mode 100644 index 0000000000..3ea591a022 --- /dev/null +++ b/test/plsql/ws/test_gw_fct_setfeaturereplaceplan.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_setfeaturereplaceplan($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, + "feature":{"featureType":"ARC", "ids":["20861"]}, "data":{"filterFields":{}, "pageInfo":{}, "catalog":"VIRTUAL"}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_setfeaturereplaceplan returns status "Accepted"' +); + +-- Finish the test +SELECT finish(); + +ROLLBACK; \ No newline at end of file