Skip to content

Commit

Permalink
include HttpStatusError as first Check in most Probes (#299) and enha…
Browse files Browse the repository at this point in the history
…nce Result reporting (#300)
  • Loading branch information
justb4 committed Oct 24, 2019
1 parent 2dd1e2d commit 19d97f1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
3 changes: 3 additions & 0 deletions GeoHealthCheck/plugins/probe/owsgetcaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class OwsGetCaps(Probe):
"""Param defs, to be specified in subclasses"""

CHECKS_AVAIL = {
'GeoHealthCheck.plugins.check.checks.HttpStatusNoError': {
'default': True
},
'GeoHealthCheck.plugins.check.checks.XmlParse': {
'default': True
},
Expand Down
5 changes: 4 additions & 1 deletion GeoHealthCheck/plugins/probe/tms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def __init__(self):
Probe.__init__(self)

CHECKS_AVAIL = {
'GeoHealthCheck.plugins.check.checks.HttpStatusNoError': {
'default': True
},
'GeoHealthCheck.plugins.check.checks.XmlParse': {
'default': True
},
Expand All @@ -24,7 +27,7 @@ def __init__(self):
'set_params': {
'strings': {
'name': 'Must contain TileMap Element',
'value': ['<TileMap']
'value': ['TileMap']
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions GeoHealthCheck/plugins/probe/wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class WfsGetFeatureBbox(Probe):
"""Param defs"""

CHECKS_AVAIL = {
'GeoHealthCheck.plugins.check.checks.HttpStatusNoError': {
'default': True
},
'GeoHealthCheck.plugins.check.checks.XmlParse': {
'default': True
},
Expand Down
5 changes: 4 additions & 1 deletion GeoHealthCheck/plugins/probe/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@ class WmsGetMapV1(Probe):
"""Param defs"""

CHECKS_AVAIL = {
'GeoHealthCheck.plugins.check.checks.HttpHasImageContentType': {
'GeoHealthCheck.plugins.check.checks.HttpStatusNoError': {
'default': True
},
'GeoHealthCheck.plugins.check.checks.NotContainsOwsException': {
'default': True
},
'GeoHealthCheck.plugins.check.checks.HttpHasImageContentType': {
'default': True
}
}
"""
Expand Down
3 changes: 2 additions & 1 deletion GeoHealthCheck/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def add_result(self, result):
self.results.append(result)
if not result.success:
self.success = False
self.message = result.message
self.results_failed.append(result)
# First failed result is usually main failure reason
self.message = self.results_failed[0].message

def get_report(self):
return {
Expand Down
5 changes: 5 additions & 0 deletions tests/data/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@
}
},
"check_vars": {
"PDOK BAG WMS - GetCaps - No HTTP Error": {
"probe_vars": "PDOK BAG WMS - GetCaps",
"check_class": "GeoHealthCheck.plugins.check.checks.HttpStatusNoError",
"parameters": {}
},
"PDOK BAG WMS - GetCaps - XML Parse": {
"probe_vars": "PDOK BAG WMS - GetCaps",
"check_class": "GeoHealthCheck.plugins.check.checks.XmlParse",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def testPluginParamDefs(self):
self.assertIsNotNone(plugin_obj)

checks = plugin_obj.CHECKS_AVAIL
self.assertEquals(len(checks), 3, 'WmsGetCaps should have 3 Checks')
self.assertEquals(len(checks), 4, 'WmsGetCaps should have 4 Checks')

parameters = plugin_obj.PARAM_DEFS
self.assertEquals(
Expand Down

0 comments on commit 19d97f1

Please sign in to comment.