Skip to content

Commit

Permalink
Merge pull request #19 from GIScience/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
TimMcCauley authored Mar 14, 2018
2 parents 62c6725 + 39ebc10 commit 43bc404
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions openpoiservice/server/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion openpoiservice/tests/test_category_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions openpoiservice/tests/test_pois.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,70 +122,70 @@
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)
data = json.loads(response.get_data(as_text=True))
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)
data = json.loads(response.get_data(as_text=True))
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)
data = json.loads(response.get_data(as_text=True))
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)
data = json.loads(response.get_data(as_text=True))
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)
data = json.loads(response.get_data(as_text=True))
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)
data = json.loads(response.get_data(as_text=True))
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)
Expand Down
4 changes: 2 additions & 2 deletions openpoiservice/tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
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)
data = json.loads(response.get_data(as_text=True))
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)
Expand Down

0 comments on commit 43bc404

Please sign in to comment.