- Timestamp:
- 03/07/11 10:12:03 (15 months ago)
- Location:
- framework/server/trunk/mapfish/tests
- Files:
-
- 2 modified
-
test_decorators.py (modified) (4 diffs)
-
test_postgis.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
framework/server/trunk/mapfish/tests/test_decorators.py
r3659 r3743 50 50 return Feature(id=1, 51 51 geometry=Point(1, 2), 52 properties={" key": "val"}52 properties={"strkey": "strval", "boolkey": True} 53 53 ) 54 54 … … 65 65 return Feature(id=1, 66 66 geometry=Point(1, 2), 67 properties={" key": "val"}67 properties={"strkey": "strval", "boolkey": True} 68 68 ) 69 69 … … 88 88 assert response.status == 200 89 89 assert response.response.content_type == 'application/json' 90 assert response.body == '{"geometry": {"type": "Point", "coordinates": [1.0, 2.0]}, "type": "Feature", "properties": {" key": "val"}, "id": 1}'90 assert response.body == '{"geometry": {"type": "Point", "coordinates": [1.0, 2.0]}, "type": "Feature", "properties": {"boolkey": true, "strkey": "strval"}, "id": 1}' 91 91 92 92 def test_feature_collection(self): … … 101 101 assert response.status == 200 102 102 assert response.response.content_type == 'text/javascript' 103 assert response.body == 'jsfunc({"geometry": {"type": "Point", "coordinates": [1.0, 2.0]}, "type": "Feature", "properties": {" key": "val"}, "id": 1});'103 assert response.body == 'jsfunc({"geometry": {"type": "Point", "coordinates": [1.0, 2.0]}, "type": "Feature", "properties": {"boolkey": true, "strkey": "strval"}, "id": 1});' -
framework/server/trunk/mapfish/tests/test_postgis.py
r3715 r3743 33 33 34 34 from sqlalchemy.ext.declarative import declarative_base 35 from sqlalchemy import (create_engine, MetaData, Column, Integer, Numeric )35 from sqlalchemy import (create_engine, MetaData, Column, Integer, Numeric, Boolean) 36 36 from sqlalchemy import orm 37 37 … … 60 60 spot_id = Column(Integer, primary_key=True) 61 61 spot_height = Column(Numeric(asdecimal=False)) 62 spot_goodness = Column(Boolean) 62 63 spot_location = GeometryColumn(Point(2)) 63 64 … … 83 84 # Insert some points into the database 84 85 session.add_all([ 85 Spot(spot_height=420.40, spot_location='POINT(0 0)' ),86 Spot(spot_height=102.34, spot_location='POINT(10 10)' ),87 Spot(spot_height=388.62, spot_location='POINT(10 11)' ),88 Spot(spot_height=1454.66, spot_location='POINT(40 34)' ),89 Spot(spot_height=54.66, spot_location='POINT(5 5)' ),90 Spot(spot_height=333.12, spot_location='POINT(2 3)' ),91 Spot(spot_height=783.55, spot_location='POINT(38 34)' ),92 Spot(spot_height=3454.67, spot_location='POINT(-134 45)' ),93 Spot(spot_height=6454.23, spot_location=None )86 Spot(spot_height=420.40, spot_location='POINT(0 0)', spot_goodness=True), 87 Spot(spot_height=102.34, spot_location='POINT(10 10)', spot_goodness=True), 88 Spot(spot_height=388.62, spot_location='POINT(10 11)', spot_goodness=True), 89 Spot(spot_height=1454.66, spot_location='POINT(40 34)', spot_goodness=True), 90 Spot(spot_height=54.66, spot_location='POINT(5 5)', spot_goodness=True), 91 Spot(spot_height=333.12, spot_location='POINT(2 3)', spot_goodness=True), 92 Spot(spot_height=783.55, spot_location='POINT(38 34)', spot_goodness=True), 93 Spot(spot_height=3454.67, spot_location='POINT(-134 45)', spot_goodness=True), 94 Spot(spot_height=6454.23, spot_location=None, spot_goodness=False) 94 95 ]) 95 96 … … 107 108 108 109 request = FakeRequest({}) 109 request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"spot_height": 12.0 }, "geometry": {"type": "Point", "coordinates": [45, 5]}}]}'110 request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"spot_height": 12.0, "spot_goodness": true}, "geometry": {"type": "Point", "coordinates": [45, 5]}}]}' 110 111 111 112 response = FakeResponse() … … 117 118 eq_(feature0.geometry.coordinates, (45.0, 5.0)) 118 119 eq_(feature0.properties["spot_height"], 12) 120 eq_(feature0.properties["spot_goodness"], True) 119 121 120 122 new_spot = session.query(Spot).filter(Spot.spot_height==12.0).one() 121 123 ok_(new_spot is not None) 122 124 eq_(session.scalar(new_spot.spot_location.wkt), u'POINT(45 5)') 125 eq_(new_spot.spot_goodness, True) 123 126 124 127 … … 329 332 eq_(feature.geometry.coordinates, (0.0, 0.0)) 330 333 eq_(feature.properties["spot_height"], 420.39999999999998) 334 eq_(feature.properties["spot_goodness"], True) 331 335 332 336
