Skip to content

Commit

Permalink
tests(plsql): add new test functions in ud
Browse files Browse the repository at this point in the history
  • Loading branch information
nperez-bgeo committed Aug 22, 2024
1 parent 11a4171 commit cb8de57
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 2 deletions.
27 changes: 27 additions & 0 deletions test/plsql/ud/test_gw_fct_getcheckdelete.sql
Original file line number Diff line number Diff line change
@@ -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_getcheckdelete($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{"id":["1"],
"featureType":"PSECTOR"}, "data":{"filterFields":{}, "pageInfo":{}}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getchilds returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
11 changes: 9 additions & 2 deletions test/plsql/ud/test_gw_fct_getselectors.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ SET client_min_messages TO WARNING;

SET search_path = "SCHEMA_NAME", public, pg_catalog;

-- Plan for 3 test
SELECT plan(3);
-- Plan for 4 test
SELECT plan(4);

-- Extract and test the "status" field from the function's JSON response
SELECT is (
Expand All @@ -35,6 +35,13 @@ SELECT is (
'Check if gw_fct_getselectors --> "currentTab":"None" returns status "Accepted"'
);

SELECT is (
(gw_fct_getselectors($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "selectorType":"selector_basic", "tabName":"tab_psector", "id":1, "isAlone":"False",
"disableParent":"False", "value":"True"}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getselectors --> "tabName":"tab_psector" returns status "Accepted"'
);

-- Finish the test
SELECT finish();
Expand Down
27 changes: 27 additions & 0 deletions test/plsql/ud/test_gw_fct_getwidgetprices.sql
Original file line number Diff line number Diff line change
@@ -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_getwidgetprices($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "tableName":"v_edit_plan_psector_x_other", "psectorId":2}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getwidgetprices returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
27 changes: 27 additions & 0 deletions test/plsql/ud/test_gw_fct_setdelete.sql
Original file line number Diff line number Diff line change
@@ -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_setdelete($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{"id":["9"],
"featureType":"PSECTOR", "tableName":"v_ui_plan_psector", "idName":"psector_id"}, "data":{"filterFields":{}, "pageInfo":{}}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_setcatalog returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;

0 comments on commit cb8de57

Please sign in to comment.