Skip to content

Commit

Permalink
Fix the tests, EPSG in capital
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jan 26, 2017
1 parent 397a7bf commit b54b438
Show file tree
Hide file tree
Showing 22 changed files with 106 additions and 78 deletions.
9 changes: 6 additions & 3 deletions tilecloud_chain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@ def __init__(self, config_file, options=None, layer_name=None, base_config={}):
if 'generation' not in self.config:
self.config['generation'] = {}
for gname, grid in sorted(self.config.get('grids', {}).items()):
grid["name"] = gname
if grid is not None:
grid["name"] = gname
for cname, cache in sorted(self.config.get('caches', {}).items()):
cache["name"] = cname
if cache is not None:
cache["name"] = cname
for lname, layer in sorted(self.config.get('layers', {}).items()):
layer["name"] = lname
if layer is not None:
layer["name"] = lname

c = Core(
source_data=self.config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ grids:
# bbox [required]
bbox: [420000, 30000, 900000, 350000]
# srs [required]
srs: epsg:21781
srs: EPSG:21781

caches:
local:
Expand Down Expand Up @@ -130,6 +130,6 @@ process:

openlayers:
# srs, center_x, center_y [required]
srs: epsg:21781
srs: EPSG:21781
center_x: 600000
center_y: 200000
2 changes: 1 addition & 1 deletion tilecloud_chain/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mapping:
required: true
srs: &srs
type: str
pattern: '^(?i)epsg:[0-9]+$'
pattern: '^EPSG:[0-9]+$'
required: true
proj4_literal:
type: str
Expand Down
44 changes: 22 additions & 22 deletions tilecloud_chain/tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def test_capabilities(self):
<TileMatrixSet>
<ows:Identifier>swissgrid_01</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>1</ows:Identifier>
<ScaleDenominator>3571.4285714[0-9]*</ScaleDenominator>
Expand Down Expand Up @@ -352,7 +352,7 @@ def test_capabilities(self):
<TileMatrixSet>
<ows:Identifier>swissgrid_025</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0_25</ows:Identifier>
<ScaleDenominator>892.85714285[0-9]*</ScaleDenominator>
Expand All @@ -367,7 +367,7 @@ def test_capabilities(self):
<TileMatrixSet>
<ows:Identifier>swissgrid_2_5</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>2_5</ows:Identifier>
<ScaleDenominator>8928.5714285[0-9]*</ScaleDenominator>
Expand All @@ -382,7 +382,7 @@ def test_capabilities(self):
<TileMatrixSet>
<ows:Identifier>swissgrid_5</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>357142.85714[0-9]*</ScaleDenominator>
Expand Down Expand Up @@ -802,7 +802,7 @@ def test_capabilities(self):
<TileMatrixSet>
<ows:Identifier>swissgrid_01</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>1</ows:Identifier>
<ScaleDenominator>3571.4285714[0-9]*</ScaleDenominator>
Expand Down Expand Up @@ -837,7 +837,7 @@ def test_capabilities(self):
<TileMatrixSet>
<ows:Identifier>swissgrid_025</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0_25</ows:Identifier>
<ScaleDenominator>892.85714285[0-9]*</ScaleDenominator>
Expand All @@ -852,7 +852,7 @@ def test_capabilities(self):
<TileMatrixSet>
<ows:Identifier>swissgrid_2_5</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>2_5</ows:Identifier>
<ScaleDenominator>8928.5714285[0-9]*</ScaleDenominator>
Expand All @@ -867,7 +867,7 @@ def test_capabilities(self):
<TileMatrixSet>
<ows:Identifier>swissgrid_5</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>357142.85714[0-9]*</ScaleDenominator>
Expand Down Expand Up @@ -1043,7 +1043,7 @@ def test_capabilities_slash(self):
<TileMatrixSet>
<ows:Identifier>swissgrid</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>357142.85714[0-9]*</ScaleDenominator>
Expand Down Expand Up @@ -1096,7 +1096,7 @@ def test_mapcache(self):
<grid name="swissgrid_01">
<size>256 256</size>
<extent>420000 30000 900000 350000</extent>
<srs>epsg:21781</srs>
<srs>EPSG:21781</srs>
<units>m</units>
<resolutions>1 0.2 0.1 </resolutions>
<origin>top-left</origin>
Expand All @@ -1105,7 +1105,7 @@ def test_mapcache(self):
<grid name="swissgrid_025">
<size>256 256</size>
<extent>420000 30000 900000 350000</extent>
<srs>epsg:21781</srs>
<srs>EPSG:21781</srs>
<units>m</units>
<resolutions>0.25 </resolutions>
<origin>top-left</origin>
Expand All @@ -1114,7 +1114,7 @@ def test_mapcache(self):
<grid name="swissgrid_2_5">
<size>256 256</size>
<extent>420000 30000 900000 350000</extent>
<srs>epsg:21781</srs>
<srs>EPSG:21781</srs>
<units>m</units>
<resolutions>2.5 </resolutions>
<origin>top-left</origin>
Expand All @@ -1123,7 +1123,7 @@ def test_mapcache(self):
<grid name="swissgrid_5">
<size>256 256</size>
<extent>420000 30000 900000 350000</extent>
<srs>epsg:21781</srs>
<srs>EPSG:21781</srs>
<units>m</units>
<resolutions>100 50 20 10 5 </resolutions>
<origin>top-left</origin>
Expand Down Expand Up @@ -1414,7 +1414,7 @@ def test_mapcache2(self):
<grid name="swissgrid_5">
<size>256 256</size>
<extent>420000 30000 900000 350000</extent>
<srs>epsg:21781</srs>
<srs>EPSG:21781</srs>
<units>m</units>
<resolutions>100 50 20 10 5 </resolutions>
<origin>top-left</origin>
Expand Down Expand Up @@ -1620,7 +1620,7 @@ def test_apache_s3_tilesurl(self):
u""" +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs
resolution_scale: 10
resolutions: [1, 0.2, 0.1]
srs: epsg:21781
srs: EPSG:21781
tile_size: 256
unit: m
swissgrid_025:
Expand All @@ -1631,7 +1631,7 @@ def test_apache_s3_tilesurl(self):
u""" +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs
resolution_scale: 4
resolutions: [0.25]
srs: epsg:21781
srs: EPSG:21781
tile_size: 256
unit: m
swissgrid_2_5:
Expand All @@ -1642,7 +1642,7 @@ def test_apache_s3_tilesurl(self):
u""" +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs
resolution_scale: 2
resolutions: [2.5]
srs: epsg:21781
srs: EPSG:21781
tile_size: 256
unit: m
swissgrid_5: &id003
Expand All @@ -1653,7 +1653,7 @@ def test_apache_s3_tilesurl(self):
u""" +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs
resolution_scale: 1
resolutions: [100, 50, 20, 10, 5]
srs: epsg:21781
srs: EPSG:21781
tile_size: 256
unit: m
layers:
Expand Down Expand Up @@ -1804,7 +1804,7 @@ def test_apache_s3_tilesurl(self):
name: point
px_buffer: 0.0
params: {}
sqs: {queue: sqs_point}
sqs: {queue: sqs_point, region: eu-west-1}
type: wms
url: http://localhost/mapserv
wmts_style: default
Expand Down Expand Up @@ -1927,7 +1927,7 @@ def test_apache_s3_tilesurl(self):
url: http://localhost/mapserv
wmts_style: default
mapcache: {config_file: mapcache.xml, memcache_host: localhost, memcache_port: 11211, location: /mapcache}
openlayers: {center_x: 600000, center_y: 200000, srs: 'epsg:21781'}
openlayers: {center_x: 600000, center_y: 200000, srs: 'EPSG:21781'}
sns: {region: eu-west-1, topic: 'arn:aws:sns:eu-west-1:your-account-id:tilecloud'}"""

@attr(general=True)
Expand Down Expand Up @@ -1994,7 +1994,7 @@ def test_openlayers(self):
map = new OpenLayers.Map({
div: "map",
projection: "epsg:21781",
projection: "EPSG:21781",
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.Zoom(),
Expand Down Expand Up @@ -2285,7 +2285,7 @@ def test_legends(self):
<TileMatrixSet>
<ows:Identifier>swissgrid</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>357142.85714[0-9]*</ScaleDenominator>
Expand Down
50 changes: 35 additions & 15 deletions tilecloud_chain/tests/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,40 @@ def test_type(self, l):
main_func=controller.main)
l.check((
'tilecloud_chain', 'ERROR', """The config file 'tilegeneration/wrong_type.yaml' in invalid.
- /grids/swissgrid!/name: Value 'swissgrid!' does not match pattern '^[a-zA-Z0-9_\\-~\\.]+$'.
- /grids/swissgrid!/name: Value 'swissgrid!' does not match pattern '^[a-zA-Z0-9_\-~\.]+$'.
- /grids/swissgrid!: Cannot find required key 'bbox'.
- /grids/swissgrid!: Cannot find required key 'resolutions'.
- /grids/swissgrid!: Cannot find required key 'srs'.
- /grids/swissgrid_1/srs: Value '{}' does not match pattern '^(?i)epsg:[0-9]+$'.
- /grids/swissgrid_1/srs: Value '{}' is not of type 'str'.
- /grids/swissgrid_2/bbox/0: Value 'a' is not of type 'number'.
- /grids/swissgrid_2/bbox/1: Value 'b' is not of type 'number'.
- /grids/swissgrid_2/bbox/2: Value 'c' is not of type 'number'.
- /grids/swissgrid_2/resolution_scale: Value '5.5' is not of type 'int'.
- /grids/swissgrid_2/srs: Value '['epsg21781']' does not match pattern '^(?i)epsg:[0-9]+$'.
- /grids/swissgrid_2/srs: Value '['epsg21781']' is not of type 'str'.
- /grids/swissgrid_1/bbox/0: Value 'a' is not of type 'number'.
- /grids/swissgrid_1/bbox/1: Value 'b' is not of type 'number'.
- /grids/swissgrid_1/bbox/2: Value 'c' is not of type 'number'.
- /grids/swissgrid_1/resolution_scale: Value '5.5' is not of type 'int'.
- /grids/swissgrid_1/srs: Value '['epsg21781']' is not of type 'str'.
- /grids/swissgrid_2/srs: Value '{}' is not of type 'str'.
- /grids/swissgrid_3/srs: Value 'epsg:21781' does not match pattern '^EPSG:[0-9]+$'.
- /grids/swissgrid_3: Cannot find required key 'bbox'.
- /grids/swissgrid_3: Cannot find required key 'resolutions'.
- /grids/swissgrid_3: Cannot find required key 'srs'.
- /grids/swissgrid_4/srs: Value 'epsg21781' does not match pattern '^EPSG:[0-9]+$'.
- /grids/swissgrid_4: Cannot find required key 'bbox'.
- /grids/swissgrid_4: Cannot find required key 'resolutions'.
- /grids/swissgrid_5: Cannot find required key 'bbox'.
- /grids/swissgrid_5: Cannot find required key 'resolutions'.
- /grids/swissgrid_5: Cannot find required key 'srs'.
- /grids/swissgrid_6: Value 'None' is not a dict. Value path: '/grids/swissgrid_6'
- /layers/hi!/dimensions/0/default: Value '2010!' does not match pattern '^[a-zA-Z0-9_\-~\.]+$'.
- /layers/hi!/dimensions/0/generate/0: Value '2012!' does not match pattern '^[a-zA-Z0-9_\-~\.]+$'.
- /layers/hi!/dimensions/0/name: Value 'DATE!' does not match pattern '^(?!(?i)(SERVICE|VERSION|REQUEST|LAYERS|STYLES|SRS|CRS|BBOX|WIDTH|HEIGHT|FORMAT|BGCOLOR|TRANSPARENT|SLD|EXCEPTIONS|SALT))[a-z0-9_\-~\.]+$'.
- /layers/hi!/dimensions/0/values/0: Value '2005!' does not match pattern '^[a-zA-Z0-9_\-~\.]+$'.
- /layers/hi!/dimensions/0/values/1: Value '2010!' does not match pattern '^[a-zA-Z0-9_\-~\.]+$'.
- /layers/hi!/dimensions/0/values/2: Value '2012!' does not match pattern '^[a-zA-Z0-9_\-~\.]+$'.
- /layers/hi!/dimensions/1/default: Value '1' is not of type 'str'.
- /layers/hi!/dimensions/1/generate/0: Value '1' is not of type 'str'.
- /layers/hi!/dimensions/1/values/0: Value '1' is not of type 'str'.
- /layers/hi!/name: Value 'hi!' does not match pattern '^[a-zA-Z0-9_\-~\.]+$'.
- /layers/hi!/wmts_style: Value 'yo!' does not match pattern '^[a-zA-Z0-9_\-~\.]+$'.
- /layers/hi!: Cannot find required key 'extension'.
- /layers/hi!: Cannot find required key 'grid'.
- /layers/hi!: Cannot find required key 'mime_type'."""
- /layers/hi!: Cannot find required key 'mime_type'.""" # noqa
))

@log_capture('tilecloud_chain')
Expand All @@ -107,7 +123,7 @@ def test_wrong_srs_auth(self, l):
main_func=controller.main)
l.check((
'tilecloud_chain', 'ERROR', """The config file 'tilegeneration/wrong_srs_auth.yaml' in invalid.
- /grids/swissgrid_01/srs: Value 'toto:21781' does not match pattern '^(?i)epsg:[0-9]+$'.""" # noqa
- /grids/swissgrid_01/srs: Value 'toto:21781' does not match pattern '^EPSG:[0-9]+$'.""" # noqa
))

@log_capture('tilecloud_chain')
Expand All @@ -118,7 +134,7 @@ def test_wrong_srs_id(self, l):
main_func=controller.main)
l.check((
'tilecloud_chain', 'ERROR', """The config file 'tilegeneration/wrong_srs_id.yaml' in invalid.
- /grids/swissgrid_01/srs: Value 'epsg:21781a' does not match pattern '^(?i)epsg:[0-9]+$'.""" # noqa
- /grids/swissgrid_01/srs: Value 'epsg:21781a' does not match pattern '^EPSG:[0-9]+$'.""" # noqa
))

@log_capture('tilecloud_chain')
Expand All @@ -129,7 +145,7 @@ def test_wrong_srs(self, l):
main_func=controller.main)
l.check((
'tilecloud_chain', 'ERROR', """The config file 'tilegeneration/wrong_srs.yaml' in invalid.
- /grids/swissgrid_01/srs: Value 'epsg21781' does not match pattern '^(?i)epsg:[0-9]+$'."""
- /grids/swissgrid_01/srs: Value 'epsg21781' does not match pattern '^EPSG:[0-9]+$'."""
))

@log_capture('tilecloud_chain')
Expand All @@ -154,5 +170,9 @@ def test_wrong_sequence(self, l):
main_func=controller.main)
l.check((
'tilecloud_chain', 'ERROR', """The config file 'tilegeneration/wrong_sequence.yaml' in invalid.
- Value: test is not of a sequence type"""
- /: Cannot find required key 'caches'.
- /: Cannot find required key 'layers'.
- /grids/test/resolutions: Value 'test' is not a list. Value path: '/grids/test/resolutions'
- /grids/test: Cannot find required key 'bbox'.
- /grids/test: Cannot find required key 'srs'."""
))
10 changes: 5 additions & 5 deletions tilecloud_chain/tests/test_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<TileMatrixSet>
<ows:Identifier>swissgrid_5</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>357142.85714[0-9]*</ScaleDenominator>
Expand Down Expand Up @@ -581,7 +581,7 @@ def test_serve_kvp(self, l):
<TileMatrixSet>
<ows:Identifier>swissgrid_01</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>1</ows:Identifier>
<ScaleDenominator>3571.4285714[0-9]*</ScaleDenominator>
Expand Down Expand Up @@ -616,7 +616,7 @@ def test_serve_kvp(self, l):
<TileMatrixSet>
<ows:Identifier>swissgrid_025</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0_25</ows:Identifier>
<ScaleDenominator>892.85714285[0-9]*</ScaleDenominator>
Expand All @@ -631,7 +631,7 @@ def test_serve_kvp(self, l):
<TileMatrixSet>
<ows:Identifier>swissgrid_2_5</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>2_5</ows:Identifier>
<ScaleDenominator>8928.5714285[0-9]*</ScaleDenominator>
Expand All @@ -646,7 +646,7 @@ def test_serve_kvp(self, l):
<TileMatrixSet>
<ows:Identifier>swissgrid_5</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:epsg::21781</ows:SupportedCRS>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>357142.85714[0-9]*</ScaleDenominator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ grids:
resolutions: [100, 50, 20, 10, 5]
bbox: [420000, 30000, 900000, 350000]
tile_size: 256
srs: epsg:21781
srs: EPSG:21781

caches:
s3-tilesurl:
Expand Down
2 changes: 1 addition & 1 deletion tilecloud_chain/tests/tilegeneration/test-bsddb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ grids:
resolutions: [100, 50, 20, 10, 5]
bbox: [420000, 30000, 900000, 350000]
tile_size: 256
srs: epsg:21781
srs: EPSG:21781

caches:
bsddb:
Expand Down
Loading

0 comments on commit b54b438

Please sign in to comment.