mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 03:07:47 +00:00
Update tests, fix check on stay name, add anonymous/public access tests, update badges format
This commit is contained in:
@@ -15,6 +15,9 @@ ispublic_fn | f
|
||||
-[ RECORD 1 ]--
|
||||
ispublic_fn | t
|
||||
|
||||
-[ RECORD 1 ]--
|
||||
ispublic_fn | f
|
||||
|
||||
-[ RECORD 1 ]--
|
||||
ispublic_fn | t
|
||||
|
||||
|
@@ -27,10 +27,10 @@ SELECT set_config('user.email', 'demo+kapla@openplotter.cloud', false);
|
||||
--SELECT set_config('vessel.client_id', 'vessels.urn:mrn:imo:mmsi:123456789', false);
|
||||
|
||||
\echo 'Process badge'
|
||||
SELECT badges_logbook_fn(5);
|
||||
SELECT badges_logbook_fn(6);
|
||||
SELECT badges_geom_fn(5);
|
||||
SELECT badges_geom_fn(6);
|
||||
SELECT badges_logbook_fn(5,NOW()::TEXT);
|
||||
SELECT badges_logbook_fn(6,NOW()::TEXT);
|
||||
SELECT badges_geom_fn(5,NOW()::TEXT);
|
||||
SELECT badges_geom_fn(6,NOW()::TEXT);
|
||||
|
||||
\echo 'Check badges for user'
|
||||
SELECT jsonb_object_keys ( a.preferences->'badges' ) FROM auth.accounts a;
|
||||
|
@@ -31,7 +31,7 @@ SELECT name,_from_time IS NOT NULL AS _from_time,_to_time IS NOT NULL AS _to_tim
|
||||
\echo 'stays'
|
||||
SELECT count(*) FROM api.stays WHERE vessel_id = current_setting('vessel.id', false);
|
||||
\echo 'stays'
|
||||
SELECT active,name,geog,stay_code FROM api.stays WHERE vessel_id = current_setting('vessel.id', false);
|
||||
SELECT active,name IS NOT NULL AS name,geog,stay_code FROM api.stays WHERE vessel_id = current_setting('vessel.id', false);
|
||||
|
||||
-- Test event logs view for user
|
||||
\echo 'eventlogs_view'
|
||||
|
@@ -50,17 +50,17 @@ count | 3
|
||||
stays
|
||||
-[ RECORD 1 ]-------------------------------------------------
|
||||
active | t
|
||||
name |
|
||||
name | f
|
||||
geog |
|
||||
stay_code | 2
|
||||
-[ RECORD 2 ]-------------------------------------------------
|
||||
active | f
|
||||
name | 0 days stay at Pojoviken in November 2023
|
||||
name | t
|
||||
geog | 0101000020E6100000B0DEBBE0E68737404DA938FBF0094E40
|
||||
stay_code | 2
|
||||
-[ RECORD 3 ]-------------------------------------------------
|
||||
active | f
|
||||
name | 0 days stay at Norra hamnen in November 2023
|
||||
name | t
|
||||
geog | 0101000020E6100000029A081B9E6E37404A5658830AFD4D40
|
||||
stay_code | 4
|
||||
|
||||
|
@@ -65,7 +65,7 @@ SELECT l.id, l.name, l.from, l.to, l.distance, l.duration, l._from_moorage_id, l
|
||||
|
||||
\echo 'api.stays'
|
||||
--SELECT * FROM api.stays s;
|
||||
SELECT m.id, m.vessel_id IS NOT NULL AS vessel_id, m.moorage_id, m.active, m.name, m.latitude, m.longitude, m.geog, m.arrived IS NOT NULL AS arrived, m.departed IS NOT NULL AS departed, m.duration, m.stay_code, m.notes FROM api.stays AS m;
|
||||
SELECT m.id, m.vessel_id IS NOT NULL AS vessel_id, m.moorage_id, m.active, m.name IS NOT NULL AS name, m.latitude, m.longitude, m.geog, m.arrived IS NOT NULL AS arrived, m.departed IS NOT NULL AS departed, m.duration, m.stay_code, m.notes FROM api.stays AS m;
|
||||
|
||||
\echo 'stays_view'
|
||||
--SELECT * FROM api.stays_view s;
|
||||
|
@@ -148,7 +148,7 @@ id | 3
|
||||
vessel_id | t
|
||||
moorage_id |
|
||||
active | t
|
||||
name |
|
||||
name | f
|
||||
latitude | 59.86
|
||||
longitude | 23.365766666666666
|
||||
geog |
|
||||
@@ -162,7 +162,7 @@ id | 1
|
||||
vessel_id | t
|
||||
moorage_id | 1
|
||||
active | f
|
||||
name | patch stay name 3
|
||||
name | t
|
||||
latitude | 60.077666666666666
|
||||
longitude | 23.530866666666668
|
||||
geog | 0101000020E6100000B0DEBBE0E68737404DA938FBF0094E40
|
||||
@@ -176,7 +176,7 @@ id | 2
|
||||
vessel_id | t
|
||||
moorage_id | 2
|
||||
active | f
|
||||
name | 0 days stay at Norra hamnen in November 2023
|
||||
name | t
|
||||
latitude | 59.97688333333333
|
||||
longitude | 23.4321
|
||||
geog | 0101000020E6100000029A081B9E6E37404A5658830AFD4D40
|
||||
|
@@ -81,6 +81,10 @@ select * from pg_policies;
|
||||
SELECT public.reverse_geocode_py_fn('nominatim', 1.4440116666666667, 38.82985166666667);
|
||||
\echo 'Test geoip reverse_geoip_py_fn'
|
||||
--SELECT reverse_geoip_py_fn('62.74.13.231');
|
||||
\echo 'Test opverpass API overpass_py_fn'
|
||||
SELECT public.overpass_py_fn(2.19917, 41.386873333333334); -- Port Olimpic
|
||||
SELECT public.overpass_py_fn(1.92574333333, 41.258915); -- Port de la Ginesta
|
||||
SELECT public.overpass_py_fn(23.4321, 59.9768833333333); -- Norra hamnen
|
||||
|
||||
-- List details product versions
|
||||
SELECT api.versions_fn();
|
||||
|
@@ -36,7 +36,7 @@ SET vessel.name = 'kapla';
|
||||
--SET vessel.client_id = 'vessels.urn:mrn:imo:mmsi:123456789';
|
||||
--SELECT * FROM api.vessels_view v;
|
||||
SELECT name, mmsi, created_at IS NOT NULL as created_at, last_contact IS NOT NULL as last_contact FROM api.vessels_view v;
|
||||
SELECT name,geojson,watertemperature,insidetemperature,outsidetemperature FROM api.monitoring_view m;
|
||||
SELECT name,geojson->'geometry' as geometry,watertemperature,insidetemperature,outsidetemperature FROM api.monitoring_view m;
|
||||
|
||||
SET "user.email" = 'demo+aava@openplotter.cloud';
|
||||
SELECT set_config('vessel.id', :'vessel_id_aava', false) IS NOT NULL as vessel_id;
|
||||
@@ -45,4 +45,4 @@ SET vessel.name = 'aava';
|
||||
--SET vessel.client_id = 'vessels.urn:mrn:imo:mmsi:787654321';
|
||||
--SELECT * FROM api.vessels_view v;
|
||||
SELECT name, mmsi, created_at IS NOT NULL as created_at, last_contact IS NOT NULL as last_contact FROM api.vessels_view v;
|
||||
SELECT name,geojson,watertemperature,insidetemperature,outsidetemperature FROM api.monitoring_view m;
|
||||
SELECT name,geojson->'geometry' as geometry,watertemperature,insidetemperature,outsidetemperature FROM api.monitoring_view m;
|
||||
|
@@ -37,9 +37,9 @@ mmsi |
|
||||
created_at | t
|
||||
last_contact | t
|
||||
|
||||
-[ RECORD 1 ]------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-[ RECORD 1 ]------+--------------------------------------------------------
|
||||
name | kapla
|
||||
geojson | {"type": "Feature", "geometry": {"type": "Point", "coordinates": [23.365766667, 59.86]}, "properties": {"name": "kapla", "latitude": 59.86, "longitude": 23.365766666666666}}
|
||||
geometry | {"type": "Point", "coordinates": [23.365766667, 59.86]}
|
||||
watertemperature |
|
||||
insidetemperature |
|
||||
outsidetemperature |
|
||||
@@ -55,9 +55,9 @@ mmsi | 787654321
|
||||
created_at | t
|
||||
last_contact | t
|
||||
|
||||
-[ RECORD 1 ]------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-[ RECORD 1 ]------+------------------------------------------------------------
|
||||
name | aava
|
||||
geojson | {"type": "Feature", "geometry": {"type": "Point", "coordinates": [2.2934791, 41.465333283]}, "properties": {"name": "aava", "latitude": 41.46533328333334, "longitude": 2.2934791}}
|
||||
geometry | {"type": "Point", "coordinates": [2.2934791, 41.465333283]}
|
||||
watertemperature | 280.25
|
||||
insidetemperature |
|
||||
outsidetemperature |
|
||||
|
@@ -133,6 +133,7 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Monitoring API unit tests
|
||||
$mymocha index4.js --reporter ./node_modules/mochawesome --reporter-options reportDir=output/,reportFilename=report4.html
|
||||
if [ $? -eq 0 ]; then
|
||||
echo OK
|
||||
@@ -141,15 +142,7 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$mymocha index5.js --reporter ./node_modules/mochawesome --reporter-options reportDir=output/,reportFilename=report5.html
|
||||
if [ $? -eq 0 ]; then
|
||||
echo OK
|
||||
else
|
||||
echo mocha index5.js
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Monitoring unit tests
|
||||
# Monitoring SQL unit tests
|
||||
psql ${PGSAIL_DB_URI} < sql/monitoring.sql > output/monitoring.sql.output
|
||||
diff sql/monitoring.sql.output output/monitoring.sql.output > /dev/null
|
||||
#diff -u sql/monitoring.sql.output output/monitoring.sql.output | wc -l
|
||||
@@ -162,6 +155,28 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Anonymous API unit tests
|
||||
$mymocha index5.js --reporter ./node_modules/mochawesome --reporter-options reportDir=output/,reportFilename=report5.html
|
||||
if [ $? -eq 0 ]; then
|
||||
echo OK
|
||||
else
|
||||
echo mocha index5.js
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Anonymous SQL unit tests
|
||||
psql ${PGSAIL_DB_URI} < sql/anonymous.sql > output/anonymous.sql.output
|
||||
diff sql/anonymous.sql.output output/anonymous.sql.output > /dev/null
|
||||
#diff -u sql/anonymous.sql.output output/anonymous.sql.output | wc -l
|
||||
#echo 0
|
||||
if [ $? -eq 0 ]; then
|
||||
echo SQL anonymous.sql OK
|
||||
else
|
||||
echo SQL anonymous.sql FAILED
|
||||
diff -u sql/anonymous.sql.output output/anonymous.sql.output
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download and update openapi documentation
|
||||
wget ${PGSAIL_API_URI} -O openapi.json
|
||||
#echo 0
|
||||
|
Reference in New Issue
Block a user