summaryrefslogtreecommitdiffstats
path: root/tests/unit/common
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/common')
-rw-r--r--tests/unit/common/test_httpClient.py10
-rw-r--r--tests/unit/common/test_openstack_utils.py1
-rw-r--r--tests/unit/common/test_template_format.py1
-rw-r--r--tests/unit/common/test_utils.py8
4 files changed, 14 insertions, 6 deletions
diff --git a/tests/unit/common/test_httpClient.py b/tests/unit/common/test_httpClient.py
index 94ac1c891..eb09d1a52 100644
--- a/tests/unit/common/test_httpClient.py
+++ b/tests/unit/common/test_httpClient.py
@@ -6,9 +6,12 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
+
import unittest
+
import mock
-import json
+from oslo_serialization import jsonutils
from yardstick.common import httpClient
@@ -21,8 +24,9 @@ class HttpClientTestCase(unittest.TestCase):
data = {'hello': 'world'}
headers = {'Content-Type': 'application/json'}
httpClient.HttpClient().post(url, data)
- mock_requests.post.assert_called_with(url, data=json.dumps(data),
- headers=headers)
+ mock_requests.post.assert_called_with(
+ url, data=jsonutils.dump_as_bytes(data),
+ headers=headers)
@mock.patch('yardstick.common.httpClient.requests')
def test_get(self, mock_requests):
diff --git a/tests/unit/common/test_openstack_utils.py b/tests/unit/common/test_openstack_utils.py
index ef619aace..d610e181c 100644
--- a/tests/unit/common/test_openstack_utils.py
+++ b/tests/unit/common/test_openstack_utils.py
@@ -11,6 +11,7 @@
# Unittest for yardstick.common.openstack_utils
+from __future__ import absolute_import
import unittest
import mock
diff --git a/tests/unit/common/test_template_format.py b/tests/unit/common/test_template_format.py
index 0e1a1a57d..2a7d80b4d 100644
--- a/tests/unit/common/test_template_format.py
+++ b/tests/unit/common/test_template_format.py
@@ -12,6 +12,7 @@
# yardstick: this file is copied from python-heatclient and slightly modified
+from __future__ import absolute_import
import mock
import unittest
import yaml
diff --git a/tests/unit/common/test_utils.py b/tests/unit/common/test_utils.py
index a64c1f1ab..267c71312 100644
--- a/tests/unit/common/test_utils.py
+++ b/tests/unit/common/test_utils.py
@@ -9,6 +9,7 @@
# Unittest for yardstick.common.utils
+from __future__ import absolute_import
import os
import mock
import unittest
@@ -17,9 +18,10 @@ from yardstick.common import utils
class IterSubclassesTestCase(unittest.TestCase):
-# Disclaimer: this class is a modified copy from
-# rally/tests/unit/common/plugin/test_discover.py
-# Copyright 2015: Mirantis Inc.
+ # Disclaimer: this class is a modified copy from
+ # rally/tests/unit/common/plugin/test_discover.py
+ # Copyright 2015: Mirantis Inc.
+
def test_itersubclasses(self):
class A(object):
pass