Merge "Follow redirects by path_or_url preprocessor validation"

This commit is contained in:
Zuul 2020-02-20 14:01:01 +00:00 committed by Gerrit Code Review
commit 2b2235f830
3 changed files with 5 additions and 2 deletions

View File

@ -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
~~~~~

View File

@ -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(

View File

@ -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")