Update json module to jsonutils
oslo project provide jsonutils, and blazar use it in many place, this PS to update the remained json moudule to oslo jsonutils for consistency. Change-Id: Iee5be5d71f60a146668dd7b380840ba8a210af99
This commit is contained in:
parent
1855e059fc
commit
0dfeabedd5
|
@ -11,7 +11,6 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import mock
|
||||
|
||||
from blazar import tests
|
||||
|
@ -21,6 +20,7 @@ from blazar.utils.openstack import placement
|
|||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture as conf_fixture
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -113,7 +113,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
}
|
||||
|
||||
kss_req.return_value = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(mock_json_data))
|
||||
200, content=jsonutils.dumps(mock_json_data))
|
||||
|
||||
result = self.client.get_resource_provider(rp_name)
|
||||
|
||||
|
@ -139,7 +139,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
}
|
||||
|
||||
kss_req.return_value = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(mock_json_data))
|
||||
200, content=jsonutils.dumps(mock_json_data))
|
||||
|
||||
result = self.client.get_resource_provider(rp_name)
|
||||
|
||||
|
@ -173,7 +173,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
'parent_provider_uuid': parent_uuid}
|
||||
|
||||
kss_req.return_value = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(mock_json_data))
|
||||
200, content=jsonutils.dumps(mock_json_data))
|
||||
|
||||
result = self.client.create_resource_provider(
|
||||
rp_name, rp_uuid=rp_uuid, parent_uuid=parent_uuid)
|
||||
|
@ -244,9 +244,9 @@ class TestPlacementClient(tests.TestCase):
|
|||
'generation': 0,
|
||||
'parent_provider_uuid': host_uuid}
|
||||
mock_call1 = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(get_json_mock))
|
||||
200, content=jsonutils.dumps(get_json_mock))
|
||||
mock_call2 = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(post_json_mock))
|
||||
200, content=jsonutils.dumps(post_json_mock))
|
||||
kss_req.side_effect = [mock_call1, mock_call2]
|
||||
|
||||
self.client.create_reservation_provider(host_name)
|
||||
|
@ -274,7 +274,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
host_name = "compute-1"
|
||||
get_json_mock = {'resource_providers': []}
|
||||
kss_req.return_value = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(get_json_mock))
|
||||
200, content=jsonutils.dumps(get_json_mock))
|
||||
self.assertRaises(
|
||||
exceptions.ResourceProviderNotFound,
|
||||
self.client.create_reservation_provider, host_name)
|
||||
|
@ -296,7 +296,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
]
|
||||
}
|
||||
mock_call1 = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(get_json_mock))
|
||||
200, content=jsonutils.dumps(get_json_mock))
|
||||
mock_call2 = fake_requests.FakeResponse(200)
|
||||
kss_req.side_effect = [mock_call1, mock_call2]
|
||||
|
||||
|
@ -326,7 +326,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
'resource_providers': []
|
||||
}
|
||||
mock_call1 = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(get_json_mock))
|
||||
200, content=jsonutils.dumps(get_json_mock))
|
||||
mock_call2 = fake_requests.FakeResponse(200)
|
||||
kss_req.side_effect = [mock_call1, mock_call2]
|
||||
|
||||
|
@ -425,7 +425,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
"resource_provider_generation": curr_gen
|
||||
}
|
||||
client_get.return_value = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(mock_get_inv_json))
|
||||
200, content=jsonutils.dumps(mock_get_inv_json))
|
||||
|
||||
# Build the mock of "updated" inventory for update_inventory()
|
||||
update_gen = 12
|
||||
|
@ -451,7 +451,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
"resource_provider_generation": update_gen
|
||||
}
|
||||
kss_req.return_value = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(mock_put_json))
|
||||
200, content=jsonutils.dumps(mock_put_json))
|
||||
|
||||
result = self.client.update_reservation_inventory(host_name, 'add', 3)
|
||||
|
||||
|
@ -516,7 +516,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
"resource_provider_generation": curr_gen
|
||||
}
|
||||
client_get.return_value = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(mock_get_inv_json))
|
||||
200, content=jsonutils.dumps(mock_get_inv_json))
|
||||
|
||||
# Build the mock of "updated" inventory for update_inventory()
|
||||
update_gen = 1
|
||||
|
@ -534,7 +534,7 @@ class TestPlacementClient(tests.TestCase):
|
|||
"resource_provider_generation": update_gen
|
||||
}
|
||||
kss_req.return_value = fake_requests.FakeResponse(
|
||||
200, content=json.dumps(mock_put_json))
|
||||
200, content=jsonutils.dumps(mock_put_json))
|
||||
|
||||
result = self.client.update_reservation_inventory(host_name, 'add', 3)
|
||||
|
||||
|
|
Loading…
Reference in New Issue