adding tests for _obs_searchtables
This commit is contained in:
54
src/pg/test/expected/42_observatory_exploration_test.out
Normal file
54
src/pg/test/expected/42_observatory_exploration_test.out
Normal file
@@ -0,0 +1,54 @@
|
||||
\i test/sql/load_fixtures.sql
|
||||
SET client_min_messages TO WARNING;
|
||||
\set ECHO none
|
||||
Loading obs_table.sql fixture file...
|
||||
Done.
|
||||
Loading obs_column.sql fixture file...
|
||||
Done.
|
||||
Loading obs_column_table.sql fixture file...
|
||||
Done.
|
||||
Loading obs_column_to_column.sql fixture file...
|
||||
Done.
|
||||
Loading obs_85328201013baa14e8e8a4a57a01e6f6fbc5f9b1.sql fixture file...
|
||||
Done.
|
||||
Loading obs_3e7cc9cfd403b912c57b42d5f9195af9ce2f3cdb.sql fixture file...
|
||||
Done.
|
||||
Loading obs_ab038198aaab3f3cb055758638ee4de28ad70146.sql fixture file...
|
||||
Done.
|
||||
Loading obs_a92e1111ad3177676471d66bb8036e6d057f271b.sql fixture file...
|
||||
Done.
|
||||
Loading obs_11ee8b82c877c073438bc935a91d3dfccef875d1.sql fixture file...
|
||||
Done.
|
||||
Loading obs_d34555209878e8c4b37cf0b2b3d072ff129ec470.sql fixture file...
|
||||
Done.
|
||||
Loading obs_b0ef6dd68d5faddbf231fd7f02916b3d00ec43c4.sql fixture file...
|
||||
Done.
|
||||
_obs_searchtables_tables_match|_obs_searchtables_timespan_matches
|
||||
t|t
|
||||
t|t
|
||||
(2 rows)
|
||||
_obs_searchtables_timespan_does_not_match
|
||||
t
|
||||
(1 row)
|
||||
Dropping obs_table.sql fixture table...
|
||||
Done.
|
||||
Dropping obs_column.sql fixture table...
|
||||
Done.
|
||||
Dropping obs_column_table.sql fixture table...
|
||||
Done.
|
||||
Dropping obs_column_to_column.sql fixture table...
|
||||
Done.
|
||||
Dropping obs_85328201013baa14e8e8a4a57a01e6f6fbc5f9b1 fixture table...
|
||||
Done.
|
||||
Dropping obs_3e7cc9cfd403b912c57b42d5f9195af9ce2f3cdb fixture table...
|
||||
Done.
|
||||
Dropping obs_ab038198aaab3f3cb055758638ee4de28ad70146 fixture table...
|
||||
Done.
|
||||
Dropping obs_a92e1111ad3177676471d66bb8036e6d057f271b fixture table...
|
||||
Done.
|
||||
Dropping obs_11ee8b82c877c073438bc935a91d3dfccef875d1 fixture table...
|
||||
Done.
|
||||
Dropping obs_d34555209878e8c4b37cf0b2b3d072ff129ec470 fixture table...
|
||||
Done.
|
||||
Dropping obs_b0ef6dd68d5faddbf231fd7f02916b3d00ec43c4 fixture table...
|
||||
Done.
|
||||
28
src/pg/test/sql/42_observatory_exploration_test.sql
Normal file
28
src/pg/test/sql/42_observatory_exploration_test.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
\i test/sql/load_fixtures.sql
|
||||
\pset format unaligned
|
||||
|
||||
-- set up variables for use in testing
|
||||
|
||||
\set cartodb_census_tract_geometry ''
|
||||
|
||||
\set cartodb_county_geometry ''
|
||||
|
||||
-- _OBS_SearchTables tests
|
||||
SELECT
|
||||
t.table_name IN ('obs_b0ef6dd68d5faddbf231fd7f02916b3d00ec43c4',
|
||||
'obs_23da37d4e66e9de2f525572967f8618bde99a8c0') As _OBS_SearchTables_tables_match,
|
||||
t.timespan = '2013' As _OBS_SearchTables_timespan_matches
|
||||
FROM cdb_observatory._OBS_SearchTables(
|
||||
'"us.census.tiger".county',
|
||||
'2013'
|
||||
) As t(table_name, timespan);
|
||||
|
||||
-- _OBS_SearchTables tests
|
||||
-- should not return tables for year that does not match
|
||||
SELECT count(*) = 0 As _OBS_SearchTables_timespan_does_not_match
|
||||
FROM cdb_observatory._OBS_SearchTables(
|
||||
'"us.census.tiger".county',
|
||||
'1988' -- year before first tiger data was collected
|
||||
) As t(table_name, timespan);
|
||||
|
||||
\i test/sql/drop_fixtures.sql
|
||||
Reference in New Issue
Block a user