Skip to content

Commit

Permalink
tests: ensure postgis plugin throws if invalid query is made - refs #792
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Dec 5, 2011
1 parent ddeca1e commit 9be619c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/python_tests/postgis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ def test_empty_db():
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)

Expand Down

0 comments on commit 9be619c

Please sign in to comment.