~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/compute/contrib/test_floating_ips.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-09-09 13:11:11 UTC
  • mfrom: (1.1.74)
  • Revision ID: package-import@ubuntu.com-20130909131111-aw02ice50wac9tma
Tags: 1:2013.2~b3-0ubuntu1
* New usptream release. 
* debian/patches/avoid_requirements_cheetah.patch: Dropped
* debian/patches/fix-sqlalchemy-0.7.9-usage.patch: Dropped
* debian/patches/fix-requirements.patch: Refreshed.
* debian/patches/path-to-the-xenhost.conf-fixup.patch: Refreshed
* debian/control: Add python-jinja2
* debian/control: Dropped python-cheetah

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import uuid
18
18
 
19
19
from lxml import etree
20
 
import testtools
21
20
import webob
22
21
 
23
22
from nova.api.openstack.compute.contrib import floating_ips
94
93
 
95
94
def stub_nw_info(stubs):
96
95
    def get_nw_info_for_instance(instance):
97
 
        return fake_network.fake_get_instance_nw_info(stubs, spectacular=True)
 
96
        return fake_network.fake_get_instance_nw_info(stubs)
98
97
    return get_nw_info_for_instance
99
98
 
100
99
 
148
147
                'nova.api.openstack.compute.contrib.select_extensions'],
149
148
            osapi_compute_ext_list=['Floating_ips'])
150
149
 
151
 
        fake_network.stub_out_nw_api_get_instance_nw_info(self.stubs,
152
 
                                                          spectacular=True)
 
150
        fake_network.stub_out_nw_api_get_instance_nw_info(self.stubs)
153
151
        self.stubs.Set(db, 'instance_get',
154
152
                       fake_instance_get)
155
153
 
307
305
        self.stubs.Set(network.api.API, "allocate_floating_ip", fake_allocate)
308
306
 
309
307
        req = fakes.HTTPRequest.blank('/v2/fake/os-floating-ips')
310
 
        with testtools.ExpectedException(webob.exc.HTTPNotFound,
311
 
                                         'No more floating ips'):
312
 
            self.controller.create(req)
 
308
        ex = self.assertRaises(webob.exc.HTTPNotFound,
 
309
                               self.controller.create, req)
 
310
 
 
311
        self.assertIn('No more floating ips', ex.explanation)
313
312
 
314
313
    def test_floating_ip_allocate_no_free_ips_pool(self):
315
314
        def fake_allocate(*args, **kwargs):
318
317
        self.stubs.Set(network.api.API, "allocate_floating_ip", fake_allocate)
319
318
 
320
319
        req = fakes.HTTPRequest.blank('/v2/fake/os-floating-ips')
321
 
        with testtools.ExpectedException(
322
 
                webob.exc.HTTPNotFound,
323
 
                'No more floating ips in pool non_existant_pool'):
324
 
            self.controller.create(req, {'pool': 'non_existant_pool'})
 
320
        ex = self.assertRaises(webob.exc.HTTPNotFound,
 
321
            self.controller.create, req, {'pool': 'non_existant_pool'})
 
322
 
 
323
        self.assertIn('No more floating ips in pool non_existant_pool',
 
324
                      ex.explanation)
325
325
 
326
326
    def test_floating_ip_allocate(self):
327
327
        def fake1(*args, **kwargs):
614
614
                'nova.api.openstack.compute.contrib.select_extensions'],
615
615
            osapi_compute_ext_list=['Floating_ips', 'Extended_floating_ips'])
616
616
 
617
 
        fake_network.stub_out_nw_api_get_instance_nw_info(self.stubs,
618
 
                                                          spectacular=True)
 
617
        fake_network.stub_out_nw_api_get_instance_nw_info(self.stubs)
619
618
        self.stubs.Set(db, 'instance_get',
620
619
                       fake_instance_get)
621
620