Mercurial > gemma
changeset 4118:b785b6bef578
Adapted db tests to new historization-implementation.
Additional test for the histoprization features and constraints would
be nice... But for now at least the existing ones run without errors...
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 31 Jul 2019 18:33:49 +0200 |
parents | ab08a74ad2f4 |
children | ad0c373dff6a d85d8de8c28c 209bdd361615 a6eda41e7724 |
files | schema/auth_tests.sql schema/gemma_tests.sql schema/run_tests.sh schema/tap_tests_data.sql |
diffstat | 4 files changed, 5 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/schema/auth_tests.sql Wed Jul 31 18:26:02 2019 +0200 +++ b/schema/auth_tests.sql Wed Jul 31 18:33:49 2019 +0200 @@ -75,11 +75,11 @@ PREPARE bn_insert (varchar, geometry(MULTIPOLYGON, 4326)) AS INSERT INTO waterway.bottlenecks ( - gauge_location, gauge_validity, validity, + gauge_location, validity, bottleneck_id, stretch, area, rb, lb, responsible_country, revisiting_time, limiting, date_info, source_organization) SELECT - location, validity, validity, + location, validity, $1, isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs, ('AT', 'XXX', '00001', '00000', 2)::isrs),
--- a/schema/gemma_tests.sql Wed Jul 31 18:26:02 2019 +0200 +++ b/schema/gemma_tests.sql Wed Jul 31 18:33:49 2019 +0200 @@ -30,40 +30,3 @@ $$, 23505, NULL, 'No duplicate geometries can be inserted into waterway_area'); - -START TRANSACTION; -CREATE TEMP TABLE new_v (v) AS - SELECT tstzrange(current_timestamp - '2 d'::interval, - current_timestamp - '12 h'::interval); -INSERT INTO waterway.gauges ( - location, - validity, - objname, - geom, - zero_point, - date_info, - source_organization, - lastupdate, - erased) -VALUES ( - ('AT', 'XXX', '00001', 'G0001', 1)::isrs, - (SELECT v FROM new_v), - 'testgauge', - ST_geomfromtext('POINT(0 0)', 4326), - 0, - current_timestamp, - 'testorganization', - current_timestamp, - true); --- Fix validity of old entry to match exclusion constraint -UPDATE waterway.gauges SET - validity = validity - (SELECT v FROM new_v) -WHERE location = ('AT', 'XXX', '00001', 'G0001', 1)::isrs - AND validity && (SELECT v FROM new_v) - AND NOT erased; -COMMIT; -SELECT results_eq($$ - SELECT count(*) FROM waterway.bottlenecks GROUP BY bottleneck_id; - $$, - CAST(ARRAY[2,2] AS bigint[]), - 'Bottlenecks have been split to two new matching gauge versions');
--- a/schema/run_tests.sh Wed Jul 31 18:26:02 2019 +0200 +++ b/schema/run_tests.sh Wed Jul 31 18:33:49 2019 +0200 @@ -80,7 +80,7 @@ -c 'SET client_min_messages TO WARNING' \ -c "DROP ROLE IF EXISTS $TEST_ROLES" \ -f "$BASEDIR"/tap_tests_data.sql \ - -c "SELECT plan(71 + ( + -c "SELECT plan(70 + ( SELECT count(*)::int FROM information_schema.tables WHERE table_schema = 'waterway'))" \
--- a/schema/tap_tests_data.sql Wed Jul 31 18:26:02 2019 +0200 +++ b/schema/tap_tests_data.sql Wed Jul 31 18:33:49 2019 +0200 @@ -57,7 +57,7 @@ current_timestamp, 'testorganization', current_timestamp) - RETURNING location, validity, validity), + RETURNING location, validity), bns AS ( VALUES ( 'testbottleneck1', @@ -75,7 +75,7 @@ 1, 'depth', current_timestamp, 'testorganization', true )) INSERT INTO waterway.bottlenecks ( - gauge_location, gauge_validity, validity, + gauge_location, validity, bottleneck_id, stretch, area, rb, lb, responsible_country, revisiting_time, limiting, date_info, source_organization, staging_done) SELECT * FROM gs, bns;