Adding tests for new json returning utility functions
This commit is contained in:
@@ -32,22 +32,29 @@ SELECT
|
||||
-- -----------|-----------------|-----------
|
||||
-- geoid | obs_{hex table} | null
|
||||
-- total_pop | obs_{hex table} | sum
|
||||
WITH result as (
|
||||
SELECT
|
||||
(unnest(cdb_observatory._OBS_GetColumnData(
|
||||
array_agg(a) expected from cdb_observatory._OBS_GetColumnData(
|
||||
'"us.census.tiger".census_tract',
|
||||
Array['"us.census.tiger".census_tract_geoid', '"us.census.acs".B01001001'],
|
||||
'2009 - 2013'
|
||||
))).*
|
||||
ORDER BY colname, tablename ASC;
|
||||
'2009 - 2013') a
|
||||
)
|
||||
select (expected)[1]::text = '{"colname":"geoid","tablename":"obs_d34555209878e8c4b37cf0b2b3d072ff129ec470","aggregate":null,"name":"US Census Tract Geoids","type":"Text","description":""}' as test_get_obs_column_with_geoid_and_census_1,
|
||||
(expected)[2]::text = '{"colname":"geoid","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":null,"name":"US Census Tract Geoids","type":"Text","description":""}' as test_get_obs_column_with_geoid_and_census_2,
|
||||
(expected)[3]::text = '{"colname":"geoid","tablename":"obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d","aggregate":null,"name":"US Census Tract Geoids","type":"Text","description":""}' as test_get_obs_column_with_geoid_and_census_3
|
||||
from result;
|
||||
|
||||
|
||||
-- should be null-valued
|
||||
WITH result as (
|
||||
SELECT
|
||||
(unnest(cdb_observatory._OBS_GetColumnData(
|
||||
array_agg(a) expected from cdb_observatory._OBS_GetColumnData(
|
||||
'"us.census.tiger".census_tract',
|
||||
Array['"us.census.tiger".baloney'], -- entry not in catalog
|
||||
'2009 - 2013'
|
||||
))).*
|
||||
ORDER BY 1 ASC;
|
||||
Array['"us.census.tiger".baloney'],
|
||||
'2009 - 2013') a
|
||||
)
|
||||
select expected is null as OBS_GetColumnDataJSON_missing_measure
|
||||
from result;
|
||||
|
||||
-- OBS_LookupCensusHuman
|
||||
-- should give back: {"\"us.census.acs\".B19083001"}
|
||||
|
||||
Reference in New Issue
Block a user