Commit 677979bc authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Fix networking client call (data-->json)

parent bc4662d8
......@@ -44,11 +44,11 @@ class NetworkingRestClient(Client):
return self.get(path4url('networks'), **kwargs)
def networks_post(self, json_data, **kwargs):
return self.post(path4url('networks'), data=dumps(json_data), **kwargs)
return self.post(path4url('networks'), json=dumps(json_data), **kwargs)
def networks_put(self, network_id, json_data, **kwargs):
return self.put(
path4url('networks', network_id), data=dumps(json_data), **kwargs)
path4url('networks', network_id), json=dumps(json_data), **kwargs)
def networks_delete(self, network_id, **kwargs):
return self.delete(path4url('networks', network_id), **kwargs)
......@@ -59,7 +59,7 @@ class NetworkingRestClient(Client):
return self.get(path4url('subnets'), **kwargs)
def subnets_post(self, json_data, **kwargs):
return self.post(path4url('subnets'), data=dumps(json_data), **kwargs)
return self.post(path4url('subnets'), json=dumps(json_data), **kwargs)
def subnets_put(self, subnet_id, **kwargs):
return self.put(path4url('subnets', subnet_id), **kwargs)
......@@ -82,7 +82,7 @@ class NetworkingRestClient(Client):
self.set_param('fixed_ips', fixed_ips, iff=fixed_ips)
self.set_param('security_groups', security_groups, iff=security_groups)
data = dumps(json_data) if json_data else None
return self.post(path4url('ports'), data=data, **kwargs)
return self.post(path4url('ports'), json=data, **kwargs)
def ports_put(
self, port_id,
......@@ -94,7 +94,7 @@ class NetworkingRestClient(Client):
self.set_param('fixed_ips', fixed_ips, iff=fixed_ips)
self.set_param('security_groups', security_groups, iff=security_groups)
data = dumps(json_data) if json_data else None
return self.put(path4url('ports', port_id), data=data, **kwargs)
return self.put(path4url('ports', port_id), json=data, **kwargs)
def ports_delete(self, port_id, **kwargs):
return self.delete(path4url('ports', port_id), **kwargs)
......@@ -76,7 +76,7 @@ class NetworkingRestClient(TestCase):
dict(json_data=dict(k2='v2'), k3='v3')):
self.assertEqual(self.client.networks_post(**kwargs), 'ret val')
json_data = kwargs.pop('json_data')
self._assert(post, '/networks', data=dumps(json_data), **kwargs)
self._assert(post, '/networks', json=dumps(json_data), **kwargs)
@patch('kamaki.clients.Client.put', return_value='ret val')
def test_networks_put(self, put):
......@@ -88,7 +88,7 @@ class NetworkingRestClient(TestCase):
self.client.networks_put(netid, **kwargs), 'ret val')
json_data = kwargs.pop('json_data')
self._assert(
put, '/networks/%s' % netid, data=dumps(json_data), **kwargs)
put, '/networks/%s' % netid, json=dumps(json_data), **kwargs)
@patch('kamaki.clients.Client.delete', return_value='ret val')
def test_networks_delete(self, delete):
......@@ -116,7 +116,7 @@ class NetworkingRestClient(TestCase):
json_data = dict(subnets='some data')
self.assertEqual(self.client.subnets_post(
json_data=json_data, **kwargs), 'ret val')
self._assert(post, '/subnets', data=dumps(json_data), **kwargs)
self._assert(post, '/subnets', json=dumps(json_data), **kwargs)
@patch('kamaki.clients.Client.put', return_value='ret val')
def test_subnets_put(self, put):
......@@ -174,14 +174,14 @@ class NetworkingRestClient(TestCase):
self.assertEqual(self.client.ports_post(**callargs), 'ret val')
self._assert(
post, '/ports', set_param,
params=params, data=None, **kwargs)
params=params, json=None, **kwargs)
json_data = dict(id='some id', other_param='other val')
callargs['json_data'] = json_data
self.assertEqual(self.client.ports_post(**callargs), 'ret val')
self._assert(
post, '/ports', set_param, params,
data=dumps(json_data), **kwargs)
json=dumps(json_data), **kwargs)
@patch('kamaki.clients.Client.set_param')
@patch('kamaki.clients.Client.put', return_value='ret val')
......@@ -213,7 +213,7 @@ class NetworkingRestClient(TestCase):
self.client.ports_put(port_id, **callargs), 'ret val')
self._assert(
put, '/ports/%s' % port_id, set_param,
params=params, data=None, **kwargs)
params=params, json=None, **kwargs)
json_data = dict(id='some id', other_param='other val')
callargs['json_data'] = json_data
......@@ -221,7 +221,7 @@ class NetworkingRestClient(TestCase):
self.client.ports_put(port_id, **callargs), 'ret val')
self._assert(
put, '/ports/%s' % port_id, set_param, params,
data=dumps(json_data), **kwargs)
json=dumps(json_data), **kwargs)
class FakeObject(object):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment