~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: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import webob
19
19
 
20
20
from nova.api.openstack.compute.contrib import floating_ips
 
21
from nova import compute
21
22
from nova import context
22
23
from nova import db
 
24
from nova import exception
23
25
from nova import network
24
 
from nova import compute
25
26
from nova import rpc
26
27
from nova.rpc import common as rpc_common
27
28
from nova import test
 
29
from nova.tests.api.openstack import fakes
28
30
from nova.tests import fake_network
29
 
from nova.tests.api.openstack import fakes
30
31
from nova import utils
31
32
 
32
33
FAKE_UUID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
184
185
        self.assertEqual(res_dict['floating_ip']['ip'], '10.10.10.10')
185
186
        self.assertEqual(res_dict['floating_ip']['instance_id'], None)
186
187
 
 
188
    def test_floating_ip_show_not_found(self):
 
189
        def fake_get_floating_ip(*args, **kwargs):
 
190
            raise exception.FloatingIpNotFound()
 
191
 
 
192
        self.stubs.Set(network.api.API, "get_floating_ip",
 
193
                       fake_get_floating_ip)
 
194
 
 
195
        req = fakes.HTTPRequest.blank('/v2/fake/os-floating-ips/9876')
 
196
 
 
197
        self.assertRaises(webob.exc.HTTPNotFound,
 
198
                          self.controller.show, req, 9876)
 
199
 
187
200
    def test_show_associated_floating_ip(self):
188
201
        def get_floating_ip(self, context, id):
189
202
            return {'id': 1, 'address': '10.10.10.10', 'pool': 'nova',
205
218
# test floating ip allocate/release(deallocate)
206
219
    def test_floating_ip_allocate_no_free_ips(self):
207
220
        def fake_call(*args, **kwargs):
208
 
            raise(rpc_common.RemoteError('NoMoreFloatingIps', '', ''))
 
221
            raise exception.NoMoreFloatingIps()
209
222
 
210
223
        self.stubs.Set(rpc, "call", fake_call)
211
224