Mercurial > gemma
changeset 108:f6aba3ee3a75
Put test data in own file for easier debugging.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 15 Jun 2018 20:05:44 +0200 |
parents | dd3dd2d94703 |
children | 0e486e6ee60d |
files | tap_tests.sql tap_tests_data.sql |
diffstat | 2 files changed, 48 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/tap_tests.sql Fri Jun 15 19:46:02 2018 +0200 +++ b/tap_tests.sql Fri Jun 15 20:05:44 2018 +0200 @@ -9,57 +9,7 @@ SET search_path TO public, wamos, wamos_waterway, wamos_fairway; --- --- Add test data --- -INSERT INTO countries VALUES ('AT'); -INSERT INTO responsibility_areas VALUES - ('AT', ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326)); - -INSERT INTO user_profiles (username, country, email_adress) - VALUES - ('waterway_user', 'AT', 'xxx'), - ('waterway_admin', 'AT', 'yyy'), - ('sys_admin', 'AT', 'zzz'); - -INSERT INTO limiting_factors VALUES ('depth'), ('width'); -INSERT INTO gauges ( - location, function_code, objname, geom, zero_point, source_organization) - VALUES - (('AT', 'XXX', '00001', '00000', 1)::isrs, - 'xxx', - 'testgauge', - ST_geomfromtext('POINT(0 0)', 4326), - 0, - 'testorganization'); -INSERT INTO bottlenecks ( - bottleneck_id, fk_g_fid, stretch, area, rb, lb, responsible_country, - revisiting_time, limiting, source_organization) - VALUES - ('testbottleneck1', - ('AT', 'XXX', '00001', '00000', 1)::isrs, - isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs, - ('AT', 'XXX', '00001', '00000', 2)::isrs), - ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326), - 'AT', 'AT', 'AT', - 1, 'depth', 'testorganization'); -INSERT INTO bottlenecks ( - bottleneck_id, fk_g_fid, stretch, area, rb, lb, responsible_country, - revisiting_time, limiting, source_organization, staging_done) - VALUES - ('testbottleneck2', - ('AT', 'XXX', '00001', '00000', 1)::isrs, - isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs, - ('AT', 'XXX', '00001', '00000', 2)::isrs), - ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326), - 'AT', 'AT', 'AT', - 1, 'depth', 'testorganization', true); - -INSERT INTO templates (dummy_attrib) - VALUES ('usertemplate'), ('othertemplate'); -INSERT INTO user_templates - SELECT 'waterway_user', id FROM templates - WHERE dummy_attrib = 'usertemplate'; +\i tap_tests_data.sql -- -- Run tests as unprivileged user
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tap_tests_data.sql Fri Jun 15 20:05:44 2018 +0200 @@ -0,0 +1,47 @@ +INSERT INTO countries VALUES ('AT'); + +INSERT INTO responsibility_areas VALUES + ('AT', ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326)); + +INSERT INTO user_profiles (username, country, email_adress) + VALUES + ('waterway_user', 'AT', 'xxx'), + ('waterway_admin', 'AT', 'yyy'), + ('sys_admin', 'AT', 'zzz'); + +INSERT INTO limiting_factors VALUES ('depth'), ('width'); + +INSERT INTO gauges ( + location, function_code, objname, geom, zero_point, source_organization) + VALUES + (('AT', 'XXX', '00001', '00000', 1)::isrs, + 'xxx', + 'testgauge', + ST_geomfromtext('POINT(0 0)', 4326), + 0, + 'testorganization'); + +INSERT INTO bottlenecks ( + bottleneck_id, fk_g_fid, stretch, area, rb, lb, responsible_country, + revisiting_time, limiting, source_organization, staging_done) + VALUES + ('testbottleneck1', + ('AT', 'XXX', '00001', '00000', 1)::isrs, + isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs, + ('AT', 'XXX', '00001', '00000', 2)::isrs), + ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326), + 'AT', 'AT', 'AT', + 1, 'depth', 'testorganization', false), + ('testbottleneck2', + ('AT', 'XXX', '00001', '00000', 1)::isrs, + isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs, + ('AT', 'XXX', '00001', '00000', 2)::isrs), + ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326), + 'AT', 'AT', 'AT', + 1, 'depth', 'testorganization', true); + +INSERT INTO templates (dummy_attrib) + VALUES ('usertemplate'), ('othertemplate'); +INSERT INTO user_templates + SELECT 'waterway_user', id FROM templates + WHERE dummy_attrib = 'usertemplate';