tests: ensure postgis plugin throws if invalid query is made - refs #792
This commit is contained in:
parent
37fee4b674
commit
0191f9c012
1 changed files with 13 additions and 0 deletions
|
@ -129,6 +129,19 @@ if 'postgis' in mapnik.DatasourceCache.instance().plugin_names() \
|
|||
feature = fs.next()
|
||||
eq_(feature,None)
|
||||
|
||||
@raises(RuntimeError)
|
||||
def test_that_nonexistant_query_field_throws(**kwargs):
|
||||
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='empty')
|
||||
eq_(len(ds.fields()),1)
|
||||
eq_(ds.fields(),['key'])
|
||||
eq_(ds.field_types(),['int'])
|
||||
query = mapnik.Query(ds.envelope())
|
||||
for fld in ds.fields():
|
||||
query.add_property_name(fld)
|
||||
# also add an invalid one, triggering throw
|
||||
query.add_property_name('bogus')
|
||||
fs = ds.features(query)
|
||||
|
||||
|
||||
atexit.register(postgis_takedown)
|
||||
|
||||
|
|
Loading…
Reference in a new issue