mirror of https://github.com/pelias/api.git
Peter Johnson
9 years ago
12 changed files with 397 additions and 0 deletions
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
#> layer alias |
||||||
|
path: '/v1/autocomplete?text=a&layers=address' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 200 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.not.exist json.geocoding.errors |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
json.geocoding.query.layers.should.eql ["address"] |
@ -0,0 +1,46 @@ |
|||||||
|
|
||||||
|
#> layer alias |
||||||
|
path: '/v1/autocomplete?text=a&layers=coarse' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 200 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.not.exist json.geocoding.errors |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
json.geocoding.query.layers.should.eql [ "continent", |
||||||
|
"macrocountry", |
||||||
|
"country", |
||||||
|
"dependency", |
||||||
|
"region", |
||||||
|
"locality", |
||||||
|
"localadmin", |
||||||
|
"county", |
||||||
|
"macrohood", |
||||||
|
"neighbourhood", |
||||||
|
"microhood", |
||||||
|
"disputed" |
||||||
|
] |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
#> layer alias |
||||||
|
path: '/v1/autocomplete?text=a&layers=notlayer' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 400 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.exist json.geocoding.errors |
||||||
|
json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,region,county,locality,continent,macrocountry,dependency,localadmin,macrohood,neighbourhood,microhood,disputed' ] |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
@ -0,0 +1,35 @@ |
|||||||
|
|
||||||
|
#> layer alias |
||||||
|
path: '/v1/autocomplete?text=a&layers=country,notlayer' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 400 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.exist json.geocoding.errors |
||||||
|
json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,region,county,locality,continent,macrocountry,dependency,localadmin,macrohood,neighbourhood,microhood,disputed' ] |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
should.not.exist json.geocoding.query['layers'] |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
#> layer alias |
||||||
|
path: '/v1/autocomplete?text=a&layers=country,region' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 200 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.not.exist json.geocoding.errors |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
json.geocoding.query.layers.should.eql ["country","region"] |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
#> layer alias |
||||||
|
path: '/v1/autocomplete?text=a&layers=country' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 200 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.not.exist json.geocoding.errors |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
json.geocoding.query.layers.should.eql ["country"] |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
#> sources filter |
||||||
|
path: '/v1/autocomplete?text=a&sources=openstreetmap,notasource' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 400 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.exist json.geocoding.errors |
||||||
|
json.geocoding.errors.should.eql [ '\'notasource\' is an invalid sources parameter. Valid options: osm,oa,gn,wof,openstreetmap,openaddresses,geonames,whosonfirst' ] |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
@ -0,0 +1,37 @@ |
|||||||
|
|
||||||
|
#> sources and layers specified (invalid combo) |
||||||
|
path: '/v1/autocomplete?text=a&sources=whosonfirst&layers=address' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 400 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.exist json.geocoding.errors |
||||||
|
json.geocoding.errors.should.eql [ 'You have specified both the `sources` and `layers` parameters in a combination that will return no results: the whosonfirst source has nothing in the address layer' ] |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
json.geocoding.query.layers.should.eql ["address"] |
||||||
|
json.geocoding.query.sources.should.eql ["whosonfirst"] |
||||||
|
should.not.exist json.geocoding.query['type'] |
@ -0,0 +1,35 @@ |
|||||||
|
|
||||||
|
#> sources and layers specified |
||||||
|
path: '/v1/autocomplete?text=a&sources=openaddresses&layers=address' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 200 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.not.exist json.geocoding.errors |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
json.geocoding.query.layers.should.eql ["address"] |
||||||
|
json.geocoding.query.sources.should.eql ["openaddresses"] |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
#> sources filter |
||||||
|
path: "/v1/autocomplete?text=a&sources=openstreetmap,geonames" |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 200 |
||||||
|
response.should.have.header "charset", 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.not.exist json.geocoding.errors |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
json.geocoding.query.sources.should.eql ["openstreetmap", "geonames"] |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
#> sources filter |
||||||
|
path: '/v1/autocomplete?text=a&sources=openstreetmap' |
||||||
|
|
||||||
|
#? 200 ok |
||||||
|
response.statusCode.should.be.equal 200 |
||||||
|
response.should.have.header 'charset', 'utf8' |
||||||
|
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||||
|
|
||||||
|
#? valid geocoding block |
||||||
|
should.exist json.geocoding |
||||||
|
should.exist json.geocoding.version |
||||||
|
should.exist json.geocoding.attribution |
||||||
|
should.exist json.geocoding.query |
||||||
|
should.exist json.geocoding.engine |
||||||
|
should.exist json.geocoding.engine.name |
||||||
|
should.exist json.geocoding.engine.author |
||||||
|
should.exist json.geocoding.engine.version |
||||||
|
should.exist json.geocoding.timestamp |
||||||
|
|
||||||
|
#? valid geojson |
||||||
|
json.type.should.be.equal 'FeatureCollection' |
||||||
|
json.features.should.be.instanceof Array |
||||||
|
|
||||||
|
#? expected errors |
||||||
|
should.not.exist json.geocoding.errors |
||||||
|
|
||||||
|
#? expected warnings |
||||||
|
should.not.exist json.geocoding.warnings |
||||||
|
|
||||||
|
#? inputs |
||||||
|
json.geocoding.query['text'].should.eql 'a' |
||||||
|
json.geocoding.query['size'].should.eql 10 |
||||||
|
json.geocoding.query.sources.should.eql ["openstreetmap"] |
Loading…
Reference in new issue