Skip to content

Commit

Permalink
tests(plsql): fix functions from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nperez-bgeo committed Aug 21, 2024
1 parent 403ce15 commit 65635e8
Show file tree
Hide file tree
Showing 13 changed files with 235 additions and 4 deletions.
8 changes: 7 additions & 1 deletion test/plsql/ud/test_gw_fct_getlist.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ SELECT is (
'Check if gw_fct_getlist --> "tableName":"cat_work" returns status "Accepted"'
);


SELECT is (
(gw_fct_getlist($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{},
"feature":{"tableName":"v_ui_rpt_cat_result"},
"data":{"filterFields":{"limit": -1, "result_id": {"filterSign":"ILIKE", "value":"1"}}, "pageInfo":{}}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getlist --> "tableName":"v_ui_rpt_cat_result" returns status "Accepted"'
);

-- Finish the test
SELECT finish();
Expand Down
8 changes: 8 additions & 0 deletions test/plsql/ud/test_gw_fct_graphanalytics_upstream.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ SELECT is (
'Check if gw_fct_graphanalytics_upstream with coordinates returns status "Accepted"'
);

SELECT is (
(gw_fct_graphanalytics_upstream($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831},
"form":{}, "feature":{"id":[35]}, "data":{"filterFields":{}, "pageInfo":{},
"coordinates":{"xcoord":418978.56563679205,"ycoord":4576668.594284589, "zoomRatio":5563.006982630196}}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_graphanalytics_upstream with coordinates and epsg returns status "Accepted"'
);

-- Finish the test
SELECT finish();

Expand Down
11 changes: 9 additions & 2 deletions test/plsql/ws/test_gw_fct_getlist.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 7 test
SELECT plan(7);
-- Plan for 8 test
SELECT plan(8);

-- Extract and test the "status" field from the function's JSON response
SELECT is (
Expand Down Expand Up @@ -70,6 +70,13 @@ SELECT is (
'Check if gw_fct_getlist --> "tableName":"v_ui_workspace" returns status "Accepted"'
);

SELECT is (
(gw_fct_getlist($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{"tableName":"v_ui_rpt_cat_result"},
"data":{"filterFields":{"limit": -1, "result_id": {"filterSign":"ILIKE", "value":"1"}}, "pageInfo":{}}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getlist --> "tableName":"v_ui_rpt_cat_result" returns status "Accepted"'
);


-- Finish the test
SELECT finish();
Expand Down
30 changes: 30 additions & 0 deletions test/plsql/ws/test_gw_fct_getmincut.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
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);

-- Previous inserts before test
INSERT INTO om_mincut VALUES (-9);

-- Extract and test the "status" field from the function's JSON response
SELECT is (
(gw_fct_getmincut($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "mincutId":"-9"}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getmincut returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
27 changes: 27 additions & 0 deletions test/plsql/ws/test_gw_fct_getprint.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_getprint($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "composers":"{composer_plan, composer_mincut}"}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getprint returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
11 changes: 10 additions & 1 deletion test/plsql/ws/test_gw_fct_getprocess.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ SELECT is (
(gw_fct_getprocess($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{},
"feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "functionId":3042}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getprocess returns status "Accepted"'
'Check if gw_fct_getprocess --> "functionId":3042 returns status "Accepted"'
);

SELECT is (
(gw_fct_getprocess($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{},
"feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "functionId":"3160"}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getprocess --> "functionId":"3160" returns status "Accepted"'
);



-- Finish the test
SELECT finish();

Expand Down
28 changes: 28 additions & 0 deletions test/plsql/ws/test_gw_fct_getreport.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
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_getreport($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "filter":[{"filterName": "Exploitation", "filterValue": "", "filterSign": "="}],
"listId":"101"}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getreport returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
27 changes: 27 additions & 0 deletions test/plsql/ws/test_gw_fct_setchangevalvestatus.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_setchangevalvestatus($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{},
"feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "nodeId":113852, "mincutId":1, "usePsectors":"False"}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_setchangevalvestatus returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
26 changes: 26 additions & 0 deletions test/plsql/ws/test_gw_fct_setcheckproject.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
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_setcheckproject($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "version":"3.6.012", "fid":101, "initProject":false, "addSchema":"NULL", "mainSchema":"NULL", "projecRole":"role_admin", "infoType":"full", "logFolderVolume":"11.28 MB", "projectType":"ws", "qgisVersion":"3.34.9-Prizren", "osVersion":"Windows 11", "fields":[ {"table_schema":"ws_21_08_2024", "table_id":"v_om_mincut_initpoint", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_om_mincut_valve", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_om_mincut_node", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_om_mincut_connec", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_om_mincut_arc", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_exploitation", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_dma", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_sector", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_dqa", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_presszone", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_node", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_connec", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_arc", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_link", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"ve_pol_connec", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"ve_pol_node", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_dimensions", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_element", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_reservoir", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_tank", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_inlet", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_junction", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_shortpipe", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_valve", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_pump", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_connec", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_pipe", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_virtualvalve", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_inp_virtualpump", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_rpt_node", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_rpt_node", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_rpt_arc", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_rpt_node_all", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_rpt_arc_all", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_rpt_node_hourly", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_rpt_arc_hourly", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_edit_plan_psector", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_plan_current_psector", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_plan_psector_connec", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_plan_psector_node", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_plan_psector_arc", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_plan_psector_link", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"ext_municipality", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_ext_address", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_ext_streetaxis", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}, {"table_schema":"ws_21_08_2024", "table_id":"v_ext_plot", "table_dbname":"giswater", "table_host":"localhost", "fid":101, "table_user":"postgres"}]}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getprint returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
27 changes: 27 additions & 0 deletions test/plsql/ws/test_gw_fct_setmincut.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_setmincut($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "action":"mincutNetwork", "mincutId":"-9", "arcId":"2071","usePsectors":"False"}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_setmincut returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
32 changes: 32 additions & 0 deletions test/plsql/ws/test_gw_fct_setprint.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
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_setprint($${"client":{"device":4, "infoType":1, "lang":"ES"}, "form":{}, "feature":{},
"data":{"composer": "composer_plan", "scale": 3096, "rotation": 0.0, "title": null,
"ComposerTemplates": [{"ComposerTemplate": "composer_plan", "ComposerMap": [{"width": 65.4621, "height": 46.5539, "name": "Mapa 1", "index": 0},
{"width": 177.676, "height": 98.32249999694072, "name": "map", "index": 1}]},
{"ComposerTemplate": "composer_mincut", "ComposerMap": [{"width": 76.7641, "height": 58.44509490998759, "name": "Mapa 2", "index": 0},
{"width": 179.414, "height": 140.8259999991146, "name": "Mapa", "index": 1}]}], "extent": {"p1": {"xcoord": 418752.6023731107, "ycoord": 4576398.707608407},
"p2": {"xcoord": 419775.9112769171, "ycoord": 4576688.740716452}}}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_getprint returns status "Accepted"'
);

-- Finish the test
SELECT finish();

ROLLBACK;
1 change: 1 addition & 0 deletions test/plsql/ws/test_gw_fct_setselectors.sql
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ SELECT is (




-- Finish the test
SELECT finish();

Expand Down
3 changes: 3 additions & 0 deletions test/plsql/ws/test_gw_fct_upsertfields.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ SELECT is (
'Check if gw_fct_upsertfields --> "tableName":"inp_dscenario_demand" returns status "Accepted"'
);

gw_fct_upsertfields($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{"id":"1, None", "tableName":"inp_dscenario_demand"},
"data":{"filterFields":{}, "pageInfo":{}, "fields":{"dscenario_id": "1", "feature_type": "NODE", "demand": "8.000000", "pattern_id": "PTN-HYDRANT", "demand_type": "3",
"source": "NODE 113961"}, "force_action":"UPDATE"}}$$);

-- Finish the test
SELECT finish();
Expand Down

0 comments on commit 65635e8

Please sign in to comment.