Health Monitor url_path requires leading slash

Change-Id: I9b5b0eb6560cf08420b37ae0eacb5e1f86f75f54
Story: 2001891
Task: 14375
changes/41/563341/1
Adam Harwell 5 years ago
parent 555c057e88
commit 791f52309c
  1. 3
      octavia/common/validate.py
  2. 9
      octavia/tests/unit/api/v2/types/test_health_monitors.py

@ -55,7 +55,8 @@ def url_path(url_path):
if (
p_url.scheme or p_url.userinfo or p_url.host or
p_url.port or
p_url.path is None
p_url.path is None or
not p_url.path.startswith('/')
):
raise exceptions.InvalidURLPath(url_path=url_path)
except Exception:

@ -87,6 +87,15 @@ class TestHealthMonitor(object):
self.assertRaises(exc.InvalidInput, wsme_json.fromjson,
self._type, body)
def test_invalid_url_path_no_leading_slash(self):
body = {"delay": 1, "timeout": 1, "max_retries": 1,
"url_path": 'blah'}
if self._type is hm_type.HealthMonitorPOST:
body.update({"type": constants.PROTOCOL_HTTP,
"pool_id": uuidutils.generate_uuid()})
self.assertRaises(exc.InvalidInput, wsme_json.fromjson,
self._type, body)
def test_invalid_expected_codes(self):
body = {"delay": 1, "timeout": 1, "max_retries": 1,
"expected_codes": "lol"}

Loading…
Cancel
Save