Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
takb committed Feb 19, 2024
1 parent 7009600 commit bc9beb3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions openpoiservice/server/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ def parse_geometries(geometry):
# parse geom if valid
geojson_obj = check_validity(g2)

if geojson_obj.is_empty:
raise api_exceptions.InvalidUsage(status_code=400, error_code=4007, message=str("geojson is empty"))

if geojson_obj.geom_type == 'Point':
check_for_buffer(geometry, ops_settings['maximum_search_radius_for_points'])

Expand Down
2 changes: 1 addition & 1 deletion openpoiservice/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def setUp(self):
db.session.remove()
db.engine.dispose()
test_file = os.path.join(os.getcwd() + '/osm', 'bremen-tests.osm.pbf')
parser.parse_file(test_file)
parser.parse_file(test_file, 0, False)

def tearDown(self):
db.session.remove()
Expand Down
3 changes: 2 additions & 1 deletion openpoiservice/tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
from base import BaseTestCase
from openpoiservice.server.db_import import parser
from openpoiservice.server import db

request_poi_bbox = dict(
request='pois',
Expand All @@ -18,7 +19,7 @@ def test_import_update_mode(self):

print("======== Perform database update =========")
updated_test_file = os.path.join(os.getcwd() + '/osm_test', 'bremen-tests-mod.osm.pbf')
parser.run_import([updated_test_file], {})
parser.run_import([updated_test_file], {}, db)

response = self.client.post('/pois', data=json.dumps(request_poi_bbox), content_type='application/json')
self.assertEqual(response.status_code, 200)
Expand Down

0 comments on commit bc9beb3

Please sign in to comment.