~ubuntu-branches/ubuntu/raring/quantum/raring

« back to all changes in this revision

Viewing changes to quantum/tests/unit/test_api_v2.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-09-21 13:01:18 UTC
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20120921130118-6x31znohp1psfc74
Tags: upstream-2012.2~rc2
ImportĀ upstreamĀ versionĀ 2012.2~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
293
293
                                                      filters=filters,
294
294
                                                      fields=fields)
295
295
 
 
296
    def test_filters_with_convert_to(self):
 
297
        instance = self.plugin.return_value
 
298
        instance.get_ports.return_value = []
 
299
 
 
300
        self.api.get(_get_path('ports'), {'admin_state_up': 'true'})
 
301
        filters = {'admin_state_up': [True]}
 
302
        instance.get_ports.assert_called_once_with(mock.ANY,
 
303
                                                   filters=filters,
 
304
                                                   fields=mock.ANY)
 
305
 
 
306
    def test_filters_with_convert_list_to(self):
 
307
        instance = self.plugin.return_value
 
308
        instance.get_ports.return_value = []
 
309
 
 
310
        self.api.get(_get_path('ports'),
 
311
                     {'fixed_ips': ['ip_address=foo', 'subnet_id=bar']})
 
312
        filters = {'fixed_ips': {'ip_address': ['foo'], 'subnet_id': ['bar']}}
 
313
        instance.get_ports.assert_called_once_with(mock.ANY,
 
314
                                                   filters=filters,
 
315
                                                   fields=mock.ANY)
 
316
 
296
317
 
297
318
# Note: since all resources use the same controller and validation
298
319
# logic, we actually get really good coverage from testing just networks.