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
This commit is contained in:
parent
a12456c17c
commit
66adfe14a6
|
@ -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(
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
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'))
|
||||
|
||||
|
|
Loading…
Reference in New Issue