Fixed observatory utility tests after merge

This commit is contained in:
Rafa de la Torre 2016-04-19 14:41:41 +02:00
parent a999c6e99c
commit 66f89e0728

View File

@ -46,13 +46,19 @@ SELECT
(1 row)
-- future test: give back nulls when geometry doesn't intersect
-- SELECT
-- cdb_observatory.OBS_GeomTable(
-- CDB_LatLng(0,0), -- should give back null since it's in the ocean?
-- '"us.census.tiger".census_tract'
-- );
-- OBS_GetColumnData
-- should give back:
-- colname | tablename | aggregate
-- -----------|-----------------|-----------
-- geoid | obs_{hex table} | null
-- total_pop | obs_{hex table} | sum
SELECT
SELECT
(unnest(cdb_observatory.OBS_GetColumnData(
'"us.census.tiger".census_tract',
Array['"us.census.tiger".census_tract_geoid', '"us.census.acs".B01001001'],
@ -68,9 +74,21 @@ ORDER BY colname, tablename ASC;
total_pop | obs_ab038198aaab3f3cb055758638ee4de28ad70146 | sum
(5 rows)
-- should be null-valued
SELECT
(unnest(cdb_observatory.OBS_GetColumnData(
'"us.census.tiger".census_tract',
Array['"us.census.tiger".baloney'], -- entry not in catalog
'2009 - 2013'
))).*
ORDER BY 1 ASC;
colname | tablename | aggregate
---------+-----------+-----------
(0 rows)
-- OBS_LookupCensusHuman
-- should give back: {"\"us.census.acs\".B19083001"}
SELECT
SELECT
cdb_observatory.OBS_LookupCensusHuman(
Array['gini_index']
);
@ -79,6 +97,11 @@ SELECT
{"\"us.census.acs\".B19083001"}
(1 row)
-- should be empty array
SELECT
cdb_observatory.OBS_LookupCensusHuman(
Array['cookies']
);
obs_lookupcensushuman
-----------------------
@ -86,7 +109,7 @@ SELECT
-- OBS_BuildSnapshotQuery
-- Should give back: SELECT vals[1] As total_pop, vals[2] As male_pop, vals[3] As female_pop, vals[4] As median_age
SELECT
SELECT
cdb_observatory.OBS_BuildSnapshotQuery(
Array['total_pop','male_pop','female_pop','median_age']
);
@ -95,6 +118,11 @@ SELECT
SELECT vals[1] As total_pop, vals[2] As male_pop, vals[3] As female_pop, vals[4] As median_age
(1 row)
-- should give back: SELECT vals[1] As mandarin_orange
SELECT
cdb_observatory.OBS_BuildSnapshotQuery(
Array['mandarin_orange']
);
obs_buildsnapshotquery
------------------------------------
SELECT vals[1] As mandarin_orange