Encode urls in unit tests
currently several unit tests are failing when path from where
they run contains url-quotable characters like '@', which apparently is
possile in e.g. Jenkins.
MODIFY
heatclient/tests/unit/test_shell.py
heatclient/tests/unit/test_shell.py
@@ -1224,7 +1224,8 @@ class ShellTestUserPass(ShellBase):
self.useFixture(fixtures.MockPatchObject(utils, 'read_url_content',
return_value='xxxxxx'))
- url = 'file://%s/private_key.env' % TEST_VAR_DIR
+ url = 'file://' + request.pathname2url(
+ '%s/private_key.env' % TEST_VAR_DIR)
template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
create_text = self.shell(
@@ -1254,7 +1255,8 @@ class ShellTestUserPass(ShellBase):
self.useFixture(fixtures.MockPatchObject(utils, 'read_url_content',
return_value='xxxxxx'))
- url = 'file://%s/private_key.env' % TEST_VAR_DIR
+ url = 'file://' + request.pathname2url(
+ '%s/private_key.env' % TEST_VAR_DIR)
template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
create_text = self.shell(

MODIFY
heatclient/tests/unit/test_utils.py
heatclient/tests/unit/test_utils.py
import os
from unittest import mock
+from urllib import request
import testtools
@@ -386,7 +387,7 @@ class TestURLFunctions(testtools.TestCase):
def test_normalise_file_path_to_url_relative(self):
self.assertEqual(
- 'file://%s/foo' % os.getcwd(),
+ 'file://' + request.pathname2url('%s/foo' % os.getcwd()),
utils.normalise_file_path_to_url(
'foo'))

Encode urls in unit tests

currently several unit tests are failing when path from where
they run contains url-quotable characters like '@', which apparently is
possile in e.g. Jenkins.

Change-Id: I44eab3f4a384a27f34e4066651baafa6a9489f49