From 75b37d5a889ac96f9361cc2430fe9dbc71047aac Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 9 Sep 2015 18:27:29 +0200 Subject: [PATCH] Improve tests #138 --- test/CDB_CartodbfyTableTest.sql | 22 ++++++++++++++++++++-- test/CDB_CartodbfyTableTest_expect | 9 ++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/test/CDB_CartodbfyTableTest.sql b/test/CDB_CartodbfyTableTest.sql index ff66564..a5b14d7 100644 --- a/test/CDB_CartodbfyTableTest.sql +++ b/test/CDB_CartodbfyTableTest.sql @@ -225,7 +225,7 @@ SELECT CDB_CartodbfyTable('original'); DROP TABLE original_renamed; DROP TABLE original; --- Table always have a default seq value after cartodbfy #123 +-- Table always have a default seq value after cartodbfy #138 CREATE TABLE bug_empty_table_no_seq ( cartodb_id integer, the_geom geometry(Geometry,4326), @@ -233,10 +233,28 @@ CREATE TABLE bug_empty_table_no_seq ( name text, description text ); -SELECT CDB_CartodbfyTable('bug_empty_table_no_seq'); +SELECT CDB_CartodbfyTableCheck('bug_empty_table_no_seq', 'Table always have a default seq value after cartodbfy #138'); INSERT INTO bug_empty_table_no_seq DEFAULT VALUES; DROP TABLE bug_empty_table_no_seq; +-- Existing cartodb_id values are respected +CREATE table existing_cartodb_id ( + cartodb_id integer, + the_geom geometry(Geometry,4326), + the_geom_webmercator geometry(Geometry,3857), + name text, + description text +); +INSERT INTO existing_cartodb_id (cartodb_id, description) VALUES + (1, 'a'), + (2, 'b'), + (3, 'c'); +SELECT CDB_CartodbfyTableCheck('existing_cartodb_id', 'Existing cartodb_id values are respected #138'); +SELECT * from existing_cartodb_id; +DROP TABLE existing_cartodb_id; + + + -- TODO: table with existing custom-triggered the_geom DROP FUNCTION CDB_CartodbfyTableCheck(regclass, text); diff --git a/test/CDB_CartodbfyTableTest_expect b/test/CDB_CartodbfyTableTest_expect index 984b939..fb2f968 100644 --- a/test/CDB_CartodbfyTableTest_expect +++ b/test/CDB_CartodbfyTableTest_expect @@ -59,8 +59,15 @@ original DROP TABLE DROP TABLE CREATE TABLE -bug_empty_table_no_seq +Table always have a default seq value after cartodbfy #138 cartodbfied fine INSERT 0 1 DROP TABLE +CREATE TABLE +INSERT 0 3 +Existing cartodb_id values are respected #138 cartodbfied fine +1|||a| +2|||b| +3|||c| +DROP TABLE DROP FUNCTION DROP FUNCTION