Merge "Follow redirects by path_or_url preprocessor validation"
This commit is contained in:
commit
2b2235f830
@ -36,6 +36,8 @@ Changed
|
||||
* `docker image <https://hub.docker.com/r/xrally/xrally>`_ is switched to use
|
||||
python3.6.
|
||||
|
||||
* *path_or_url* plugin follows redirects while validating urls now.
|
||||
|
||||
Fixed
|
||||
~~~~~
|
||||
|
||||
|
@ -30,7 +30,7 @@ class PathOrUrl(types.ResourceType):
|
||||
if os.path.isfile(path):
|
||||
return path
|
||||
try:
|
||||
head = requests.head(path, verify=False)
|
||||
head = requests.head(path, verify=False, allow_redirects=True)
|
||||
if head.status_code == 200:
|
||||
return path
|
||||
raise exceptions.InvalidScenarioArgument(
|
||||
|
@ -37,7 +37,8 @@ class PathOrUrlTestCase(test.TestCase):
|
||||
self.assertRaises(exceptions.InvalidScenarioArgument,
|
||||
types.PathOrUrl({}, {}).pre_process,
|
||||
"fake_path", {})
|
||||
mock_requests_head.assert_called_once_with("fake_path", verify=False)
|
||||
mock_requests_head.assert_called_once_with(
|
||||
"fake_path", verify=False, allow_redirects=True)
|
||||
|
||||
@mock.patch("os.path.isfile")
|
||||
@mock.patch("requests.head")
|
||||
|
Loading…
Reference in New Issue
Block a user