aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-05-25 09:38:40 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2019-05-25 11:26:46 +0200
commit94b00b4a8fe8f338d2ad60a7c9836013154bb704 (patch)
treea3bb2615acdcc52af79920a68374b72d4e0ff087 /functest/tests
parenta02c3601c488f6bdd6e57e7cebeb00f7daf8f1c9 (diff)
Set utf-8 in decode and encode calls
It eases backporting in iruya and hunter as a few logs can't be decoded as ascii [1]. [1] https://build.opnfv.org/ci/job/functest-opnfv-functest-vnf-iruya-juju_epc-run/56/console Change-Id: I52a6f9a25130cbf62e8ce3b9972064ab73177665 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 5853dd1ef3c522a975f9685250b1b3e85588f738)
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/openstack/rally/test_rally.py6
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py8
2 files changed, 7 insertions, 7 deletions
diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py
index 87c429b9e..26de0edcc 100644
--- a/functest/tests/unit/openstack/rally/test_rally.py
+++ b/functest/tests/unit/openstack/rally/test_rally.py
@@ -78,13 +78,13 @@ class OSRallyTesting(unittest.TestCase):
calls = [
mock.call(['rally', 'deployment', 'destroy', '--deployment',
str(getattr(config.CONF, 'rally_deployment_name'))]),
- mock.call().decode(),
+ mock.call().decode("utf-8"),
mock.call(['rally', 'deployment', 'create', '--fromenv', '--name',
str(getattr(config.CONF, 'rally_deployment_name'))],
env=None),
- mock.call().decode(),
+ mock.call().decode("utf-8"),
mock.call(['rally', 'deployment', 'check']),
- mock.call().decode()]
+ mock.call().decode("utf-8")]
mock_exec.assert_has_calls(calls)
@mock.patch('functest.opnfv_tests.openstack.rally.rally.os.path.exists')
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index bad353d5b..b2ce3b29d 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -99,7 +99,7 @@ class FunctestUtilsTesting(unittest.TestCase):
mock.patch('six.moves.builtins.open',
mock.mock_open()) as mopen:
stream = six.BytesIO()
- stream.write(self.cmd_readline().encode())
+ stream.write(self.cmd_readline().encode("utf-8"))
mock_obj2 = mock.Mock()
attrs = {'stdout': stream, 'wait.return_value': 1}
mock_obj2.configure_mock(**attrs)
@@ -120,7 +120,7 @@ class FunctestUtilsTesting(unittest.TestCase):
mock.patch('six.moves.builtins.open',
mock.mock_open()) as mopen:
stream = six.BytesIO()
- stream.write(self.cmd_readline().encode())
+ stream.write(self.cmd_readline().encode("utf-8"))
mock_obj2 = mock.Mock()
attrs = {'stdout': stream, 'wait.return_value': 0}
mock_obj2.configure_mock(**attrs)
@@ -139,7 +139,7 @@ class FunctestUtilsTesting(unittest.TestCase):
with mock.patch('functest.utils.functest_utils.subprocess.Popen') \
as mock_subproc_open:
stream = six.BytesIO()
- stream.write(self.cmd_readline().encode())
+ stream.write(self.cmd_readline().encode("utf-8"))
mock_obj2 = mock.Mock()
attrs = {'stdout': stream, 'wait.return_value': 0}
mock_obj2.configure_mock(**attrs)
@@ -155,7 +155,7 @@ class FunctestUtilsTesting(unittest.TestCase):
with mock.patch('functest.utils.functest_utils.subprocess.Popen') \
as mock_subproc_open:
stream = six.BytesIO()
- stream.write(self.cmd_readline().encode())
+ stream.write(self.cmd_readline().encode("utf-8"))
mock_obj2 = mock.Mock()
attrs = {'stdout': stream, 'wait.return_value': 1}
mock_obj2.configure_mock(**attrs)