Revision 1ad949a7 kamaki/clients/network/test.py

b/kamaki/clients/network/test.py
172 172
                'ret val')
173 173
            self._assert(put, '/ports/%s' % port_id, json=json_data, **kwargs)
174 174

  
175
    @patch('kamaki.clients.Client.get', return_value='ret val')
176
    def test_floatingips_get(self, get):
177
        for kwargs in (dict(), dict(k1='v1'), dict(k2='v2', k3='v3')):
178
            self.assertEqual(self.client.floatingips_get(**kwargs), 'ret val')
179
            self._assert(get, '/floatingips', **kwargs)
180

  
181
            floatingip_id = 'port id'
182
            self.assertEqual(
183
                self.client.floatingips_get(
184
                    floatingip_id=floatingip_id, **kwargs),
185
                'ret val')
186
            self._assert(get, '/floatingips/%s' % floatingip_id, **kwargs)
187

  
188
    @patch('kamaki.clients.Client.post', return_value='ret val')
189
    def test_floatingips_post(self, post):
190
        for kwargs in (dict(), dict(k1='v1'), dict(k2='v2', k3='v3')):
191
            json_data = dict(id='some id', other_param='other val')
192
            self.assertEqual(
193
                self.client.floatingips_post(json_data=json_data, **kwargs),
194
                'ret val')
195
            self._assert(post, '/floatingips', json=json_data, **kwargs)
196

  
197
    @patch('kamaki.clients.Client.put', return_value='ret val')
198
    def test_floatingips_put(self, put):
199
        floatingip_id = 'portid'
200
        for kwargs in (dict(), dict(k1='v1'), dict(k2='v2', k3='v3')):
201
            json_data = dict(id='some id', other_param='other val')
202
            self.assertEqual(
203
                self.client.floatingips_put(
204
                    floatingip_id, json_data=json_data, **kwargs),
205
                'ret val')
206
            self._assert(
207
                put, '/floatingips/%s' % floatingip_id,
208
                json=json_data, **kwargs)
209

  
175 210

  
176 211
class FakeObject(object):
177 212

  

Also available in: Unified diff