def test_post(self): prediction = create_prediction() payload = tiles.tiles_for_prediction(prediction.id) response = self.client.post( f'/v1/model/prediction/{prediction.id}/tiles', data=json.dumps(payload), content_type='application/json') assert (response.status_code == 200)
def test_get_outside_bbox(self): prediction = create_prediction() create_prediction_tiles(prediction.id) response = self.client.get( f'/v1/model/{prediction.model_id}/tiles?bbox=10.05,53.52,10.08,53.54&zoom=18' ) assert (response.get_json() == { 'error': 'No predictions for this bbox' }) assert (response.status_code == 404)
def test_get(self): prediction = create_prediction() ml_model_id = prediction.model_id response = self.client.get( f"/v1/model/{ml_model_id}/prediction?" "bbox=10.013795,53.5225," "10.048885,53.540843" ) assert len(response.get_json()) == 1
def test_geojson_post(self): prediction = create_prediction() create_prediction_tiles(prediction.id) payload = geojson.get_geojson() response = self.client.post( f'/v1/model/{prediction.model_id}/tiles/geojson', data=json.dumps(payload), content_type='application/json') assert (response.status_code == 200) assert (len(response.get_json()['features']) == 3)