~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman, Adam Gandelman, Chuck Short
  • Date: 2012-08-27 15:37:18 UTC
  • mfrom: (1.1.60)
  • Revision ID: package-import@ubuntu.com-20120827153718-lj8er44eqqz1gsrj
Tags: 2012.2~rc1~20120827.15815-0ubuntu1
[ Adam Gandelman ]
* New upstream release.

[ Chuck Short ]
* debian/patches/0001-Update-tools-hacking-for-pep8-1.2-and-
  beyond.patch: Dropped we dont run pep8 tests anymore.
* debian/control: Drop pep8 build depends
* debian/*.upstart.in: Make sure we transition correctly from runlevel
  1 to 2. (LP: #820694)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from nova.api.openstack.compute.contrib import extended_server_attributes
20
20
from nova import compute
 
21
from nova import db
21
22
from nova import exception
22
23
from nova import flags
23
24
from nova.openstack.common import jsonutils
44
45
    ]
45
46
 
46
47
 
 
48
def fake_cn_get(context, host):
 
49
    return {"hypervisor_hostname": host}
 
50
 
 
51
 
47
52
class ExtendedServerAttributesTest(test.TestCase):
48
53
    content_type = 'application/json'
49
54
    prefix = 'OS-EXT-SRV-ATTR:'
53
58
        fakes.stub_out_nw_api(self.stubs)
54
59
        self.stubs.Set(compute.api.API, 'get', fake_compute_get)
55
60
        self.stubs.Set(compute.api.API, 'get_all', fake_compute_get_all)
 
61
        self.stubs.Set(db, 'compute_node_get_by_host', fake_cn_get)
56
62
 
57
63
    def _make_request(self, url):
58
64
        req = webob.Request.blank(url)
70
76
        self.assertEqual(server.get('%shost' % self.prefix), host)
71
77
        self.assertEqual(server.get('%sinstance_name' % self.prefix),
72
78
                         instance_name)
 
79
        self.assertEqual(server.get('%shypervisor_hostname' % self.prefix),
 
80
                         host)
73
81
 
74
82
    def test_show(self):
75
83
        url = '/v2/fake/servers/%s' % UUID3