From 32f632578a4ff309177f138828776290af150238 Mon Sep 17 00:00:00 2001 From: TimMcCauley Date: Wed, 14 Mar 2018 09:26:22 +0100 Subject: [PATCH 1/3] Changed endpoint to pois --- openpoiservice/server/api/{places_post.yml => pois_post.yml} | 0 openpoiservice/server/api/views.py | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename openpoiservice/server/api/{places_post.yml => pois_post.yml} (100%) diff --git a/openpoiservice/server/api/places_post.yml b/openpoiservice/server/api/pois_post.yml similarity index 100% rename from openpoiservice/server/api/places_post.yml rename to openpoiservice/server/api/pois_post.yml diff --git a/openpoiservice/server/api/views.py b/openpoiservice/server/api/views.py index 5afbad5..ddffb50 100755 --- a/openpoiservice/server/api/views.py +++ b/openpoiservice/server/api/views.py @@ -71,8 +71,8 @@ def custom_schema(): main_blueprint = Blueprint('main', __name__, ) -@main_blueprint.route('/places', methods=['POST']) -@swag_from('places_post.yml', methods=['POST']) +@main_blueprint.route('/pois', methods=['POST']) +@swag_from('pois_post.yml', methods=['POST']) def places(): """ Function called when user posts or gets to /places. From 1bd97942fcf249d2fa6eb44dd8a76894527f4a85 Mon Sep 17 00:00:00 2001 From: TimMcCauley Date: Wed, 14 Mar 2018 09:27:40 +0100 Subject: [PATCH 2/3] Updated tests --- openpoiservice/tests/test_stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpoiservice/tests/test_stats.py b/openpoiservice/tests/test_stats.py index 6f231ec..5d18250 100644 --- a/openpoiservice/tests/test_stats.py +++ b/openpoiservice/tests/test_stats.py @@ -38,7 +38,7 @@ class TestPoisBlueprint(BaseTestCase): def test_request_stats_category_ids_point_geom(self): - response = self.client.post('/places', data=json.dumps(request_stats_category_ids_point_geom), + response = self.client.post('/pois', data=json.dumps(request_stats_category_ids_point_geom), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'places', response.data) @@ -46,7 +46,7 @@ def test_request_stats_category_ids_point_geom(self): self.assertEqual(data['places']['total_count'], 6) def test_request_stats_category_group_ids_point_geom(self): - response = self.client.post('/places', data=json.dumps(request_stats_category_group_ids_point_geom), + response = self.client.post('/pois', data=json.dumps(request_stats_category_group_ids_point_geom), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'places', response.data) From 39ebc1068216f14a60c872bbec0d2be9155db9af Mon Sep 17 00:00:00 2001 From: TimMcCauley Date: Wed, 14 Mar 2018 09:29:13 +0100 Subject: [PATCH 3/3] Updated tests --- openpoiservice/tests/test_category_list.py | 2 +- openpoiservice/tests/test_pois.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openpoiservice/tests/test_category_list.py b/openpoiservice/tests/test_category_list.py index 9ad6787..76fe6ef 100755 --- a/openpoiservice/tests/test_category_list.py +++ b/openpoiservice/tests/test_category_list.py @@ -10,7 +10,7 @@ class TestCategoryListBlueprint(BaseTestCase): def test_category_list(self): - response = self.client.post('/places', data=json.dumps(dict(request='list')), + response = self.client.post('/pois', data=json.dumps(dict(request='list')), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'accomodation', response.data) diff --git a/openpoiservice/tests/test_pois.py b/openpoiservice/tests/test_pois.py index 5f2c549..219c9cd 100644 --- a/openpoiservice/tests/test_pois.py +++ b/openpoiservice/tests/test_pois.py @@ -122,22 +122,22 @@ class TestPoisBlueprint(BaseTestCase): def test_request_poi_missing_geom(self): - response = self.client.post('/places', data=json.dumps(request_poi_missing_geometry), + response = self.client.post('/pois', data=json.dumps(request_poi_missing_geometry), content_type='application/json') self.assertEqual(response.status_code, 401) def test_request_poi_missing_geometry_geom(self): - response = self.client.post('/places', data=json.dumps(request_poi_missing_geometry_geom), + response = self.client.post('/pois', data=json.dumps(request_poi_missing_geometry_geom), content_type='application/json') self.assertEqual(response.status_code, 401) def test_request_poi_missing_geometry_type(self): - response = self.client.post('/places', data=json.dumps(request_poi_missing_geometry_type), + response = self.client.post('/pois', data=json.dumps(request_poi_missing_geometry_type), content_type='application/json') self.assertEqual(response.status_code, 401) def test_request_poi_point_geom(self): - response = self.client.post('/places', data=json.dumps(request_poi_point_geom), + response = self.client.post('/pois', data=json.dumps(request_poi_point_geom), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'features', response.data) @@ -145,7 +145,7 @@ def test_request_poi_point_geom(self): self.assertEqual(len(data['features']), 13) def test_request_poi_point_geom_with_bbox(self): - response = self.client.post('/places', data=json.dumps(request_poi_point_geom_with_bbox), + response = self.client.post('/pois', data=json.dumps(request_poi_point_geom_with_bbox), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'features', response.data) @@ -153,7 +153,7 @@ def test_request_poi_point_geom_with_bbox(self): self.assertEqual(len(data['features']), 7) def test_request_poi_polygon_geom(self): - response = self.client.post('/places', data=json.dumps(request_poi_polygon_geom), + response = self.client.post('/pois', data=json.dumps(request_poi_polygon_geom), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'features', response.data) @@ -161,7 +161,7 @@ def test_request_poi_polygon_geom(self): self.assertEqual(len(data['features']), 7) def test_request_poi_polygon_geom_with_bbox(self): - response = self.client.post('/places', data=json.dumps(request_poi_polygon_geom_with_bbox), + response = self.client.post('/pois', data=json.dumps(request_poi_polygon_geom_with_bbox), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'features', response.data) @@ -169,7 +169,7 @@ def test_request_poi_polygon_geom_with_bbox(self): self.assertEqual(len(data['features']), 1) def test_request_poi_linestring_geom(self): - response = self.client.post('/places', data=json.dumps(request_poi_linestring_geom), + response = self.client.post('/pois', data=json.dumps(request_poi_linestring_geom), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'features', response.data) @@ -177,7 +177,7 @@ def test_request_poi_linestring_geom(self): self.assertEqual(len(data['features']), 3) def test_request_poi_linestring_geom_with_bbox(self): - response = self.client.post('/places', data=json.dumps(request_poi_linestring_geom_with_bbox), + response = self.client.post('/pois', data=json.dumps(request_poi_linestring_geom_with_bbox), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'features', response.data) @@ -185,7 +185,7 @@ def test_request_poi_linestring_geom_with_bbox(self): self.assertEqual(len(data['features']), 6) def test_request_poi_bbox(self): - response = self.client.post('/places', data=json.dumps(request_poi_bbox), + response = self.client.post('/pois', data=json.dumps(request_poi_bbox), content_type='application/json') self.assertEqual(response.status_code, 200) self.assertIn(b'features', response.data)