diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2019-11-16 20:22:01 +0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-11-18 15:32:44 +0100 |
| commit | f95b59a1b3c7b24b4226bb81fc45248595b32263 (patch) | |
| tree | fe5692fc00a651d70b83531dbae97975dc52d5dc /tests | |
| parent | 7f0946298ea2e2b70a1981a3898cf4faf052ef63 (diff) | |
Fixed #30994 -- Added Oracle support for AsGeoJSON GIS function.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/geoapp/test_functions.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index a386896d24..a504587ab2 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -32,24 +32,27 @@ class GISFunctionsTests(FuncTestMixin, TestCase): return pueblo_json = '{"type":"Point","coordinates":[-104.609252,38.255001]}' - houston_json = ( + houston_json = json.loads( '{"type":"Point","crs":{"type":"name","properties":' '{"name":"EPSG:4326"}},"coordinates":[-95.363151,29.763374]}' ) - victoria_json = ( + victoria_json = json.loads( '{"type":"Point","bbox":[-123.30519600,48.46261100,-123.30519600,48.46261100],' '"coordinates":[-123.305196,48.462611]}' ) - chicago_json = ( + chicago_json = json.loads( '{"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:4326"}},' '"bbox":[-87.65018,41.85039,-87.65018,41.85039],"coordinates":[-87.65018,41.85039]}' ) - # MySQL ignores the crs option. - if mysql: - houston_json = json.loads(houston_json) + # MySQL and Oracle ignore the crs option. + if mysql or oracle: del houston_json['crs'] - chicago_json = json.loads(chicago_json) del chicago_json['crs'] + # Oracle ignores also the bbox and precision options. + if oracle: + del chicago_json['bbox'] + del victoria_json['bbox'] + chicago_json['coordinates'] = [-87.650175, 41.850385] # Precision argument should only be an integer with self.assertRaises(TypeError): @@ -75,10 +78,10 @@ class GISFunctionsTests(FuncTestMixin, TestCase): # WHERE "geoapp_city"."name" = 'Houston'; # This time we include the bounding box by using the `bbox` keyword. self.assertJSONEqual( - victoria_json, City.objects.annotate( geojson=functions.AsGeoJSON('point', bbox=True) - ).get(name='Victoria').geojson + ).get(name='Victoria').geojson, + victoria_json, ) # SELECT ST_AsGeoJson("geoapp_city"."point", 5, 3) FROM "geoapp_city" |
