Skip to content

Commit 1010228

Browse files
committed
tests(plsql): add new functions
1 parent 496259e commit 1010228

File tree

5 files changed

+78
-17
lines changed

5 files changed

+78
-17
lines changed

test/plsql/ud/test_gw_fct_getreport.sql

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@ SET client_min_messages TO WARNING;
1010

1111
SET search_path = "SCHEMA_NAME", public, pg_catalog;
1212

13-
-- Plan for 1 test
14-
SELECT plan(1);
13+
-- Plan for 2 test
14+
SELECT plan(2);
1515

1616
-- Extract and test the "status" field from the function's JSON response
1717
SELECT is (
18-
(gw_fct_getreport($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
19-
"data":{"filterFields":{}, "pageInfo":{}, "filter":[{"filterName": "Exploitation", "filterValue": "", "filterSign": "="},
20-
{"filterName": "Arc Catalog", "filterValue": "", "filterSign": "="}], "listId":"100"}}$$)::JSON)->>'status',
18+
(gw_fct_getreport($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
19+
"data":{"filterFields":{}, "pageInfo":{}, "filterText":null, "listId":"100"}}$$)::JSON)->>'status',
2120
'Accepted',
2221
'Check if gw_fct_getreport returns status "Accepted"'
2322
);
2423

24+
SELECT is (
25+
(gw_fct_getreport($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
26+
"data":{"filterFields":{}, "pageInfo":{}, "filter":[{"filterName": "Exploitation", "filterValue": "", "filterSign": "="},
27+
{"filterName": "Arc Catalog", "filterValue": "", "filterSign": "="}], "listId":"100"}}$$)::JSON)->>'status',
28+
'Accepted',
29+
'Check if gw_fct_getreport with "filter" returns status "Accepted"'
30+
);
2531

2632
-- Finish the test
2733
SELECT finish();

test/plsql/ud/test_gw_fct_gettoolbox.sql

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,22 @@ SET client_min_messages TO WARNING;
1010

1111
SET search_path = "SCHEMA_NAME", public, pg_catalog;
1212

13-
-- Plan for 1 test
14-
SELECT plan(1);
13+
-- Plan for 2 test
14+
SELECT plan(2);
1515

1616
-- Extract and test the "status" field from the function's JSON response
1717
SELECT is (
18-
(gw_fct_gettoolbox($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{},
18+
(gw_fct_gettoolbox($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{},
1919
"feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "isToolbox":true}}$$)::JSON)->>'status',
2020
'Accepted',
21-
'Check if gw_fct_gettoolbox --> returns status "Accepted"'
21+
'Check if gw_fct_gettoolbox returns status "Accepted"'
22+
);
23+
24+
SELECT is (
25+
(gw_fct_gettoolbox($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{},
26+
"feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "filterText":"c"}}$$)::JSON)->>'status',
27+
'Accepted',
28+
'Check if gw_fct_gettoolbox with filterText returns status "Accepted"'
2229
);
2330

2431
-- Finish the test

test/plsql/ws/test_gw_fct_getreport.sql

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,23 @@ SET client_min_messages TO WARNING;
1010

1111
SET search_path = "SCHEMA_NAME", public, pg_catalog;
1212

13-
-- Plan for 1 test
14-
SELECT plan(1);
13+
-- Plan for 2 test
14+
SELECT plan(2);
1515

1616
-- Extract and test the "status" field from the function's JSON response
17+
SELECT is (
18+
(gw_fct_getreport($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
19+
"data":{"filterFields":{}, "pageInfo":{}, "filterText":null, "listId":"101"}}$$)::JSON)->>'status',
20+
'Accepted',
21+
'Check if gw_fct_getreport returns status "Accepted"'
22+
);
23+
1724
SELECT is (
1825
(gw_fct_getreport($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
1926
"data":{"filterFields":{}, "pageInfo":{}, "filter":[{"filterName": "Exploitation", "filterValue": "", "filterSign": "="}],
2027
"listId":"101"}}$$)::JSON)->>'status',
2128
'Accepted',
22-
'Check if gw_fct_getreport returns status "Accepted"'
29+
'Check if gw_fct_getreport with "filter" returns status "Accepted"'
2330
);
2431

2532
-- Finish the test

test/plsql/ws/test_gw_fct_getselectors.sql

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,36 @@ SET client_min_messages TO WARNING;
1010

1111
SET search_path = "SCHEMA_NAME", public, pg_catalog;
1212

13-
-- Plan for 3 test
14-
SELECT plan(3);
13+
-- Plan for 4 test
14+
SELECT plan(4);
1515

1616
-- Extract and test the "status" field from the function's JSON response
1717
SELECT is (
1818
(gw_fct_getselectors($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{"currentTab":"tab_exploitation"}, "feature":{},
1919
"data":{"filterFields":{}, "pageInfo":{}, "selectorType":"selector_basic", "filterText":"", "addSchema":"NULL"}}$$)::JSON)->>'status',
2020
'Accepted',
21-
'Check if gw_fct_getselectors --> GwSelectorButton returns status "Accepted"'
21+
'Check if gw_fct_getselectors --> "currentTab":"tab_exploitation" returns status "Accepted"'
2222
);
2323

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

3131
SELECT is (
3232
(gw_fct_getselectors($${"client":{"device":4, "lang":"es_ES", "infoType":1, "epsg":25831}, "form":{"currentTab":"tab_dscenario"}, "feature":{},
3333
"data":{"filterFields":{}, "pageInfo":{}, "selectorType":"selector_basic", "filterText":"", "addSchema":"NULL"}}$$)::JSON)->>'status',
3434
'Accepted',
35-
'Check if gw_fct_getselectors --> GwGo2EpaButton returns status "Accepted"'
35+
'Check if gw_fct_getselectors --> "currentTab":"tab_dscenario" returns status "Accepted"'
36+
);
37+
38+
SELECT is (
39+
(gw_fct_getselectors($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{"currentTab":"None"}, "feature":{},
40+
"data":{"filterFields":{}, "pageInfo":{}, "selectorType":"selector_basic", "filterText":""}}$$)::JSON)->>'status',
41+
'Accepted',
42+
'Check if gw_fct_getselectors --> "currentTab":"None" returns status "Accepted"'
3643
);
3744

3845
-- Finish the test
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
This file is part of Giswater 3
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.
4+
This version of Giswater is provided by Giswater Association
5+
*/
6+
BEGIN;
7+
8+
-- Suppress NOTICE messages
9+
SET client_min_messages TO WARNING;
10+
11+
SET search_path = "SCHEMA_NAME", public, pg_catalog;
12+
13+
-- Plan for 2 test
14+
SELECT plan(2);
15+
16+
-- Extract and test the "status" field from the function's JSON response
17+
SELECT is (
18+
(gw_fct_gettoolbox($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{},
19+
"feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "isToolbox":true}}$$)::JSON)->>'status',
20+
'Accepted',
21+
'Check if gw_fct_gettoolbox returns status "Accepted"'
22+
);
23+
24+
SELECT is (
25+
(gw_fct_gettoolbox($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{},
26+
"feature":{}, "data":{"filterFields":{}, "pageInfo":{}, "filterText":"a"}}$$)::JSON)->>'status',
27+
'Accepted',
28+
'Check if gw_fct_gettoolbox with filterText returns status "Accepted"'
29+
);
30+
31+
-- Finish the test
32+
SELECT finish();
33+
34+
ROLLBACK;

0 commit comments

Comments
 (0)