Fix typo in server diagnostics extension.
* Fixes bug 957716 * Tweak test to catch regression Change-Id: I71cafadfec90d907a65429e1c1ca1812d1069b25
This commit is contained in:
parent
898f86cef9
commit
74aa84b0ec
@ -42,7 +42,7 @@ class ServerDiagnosticsController(object):
|
||||
authorize(context)
|
||||
compute_api = compute.API()
|
||||
try:
|
||||
instance = compute_api.get(context, id)
|
||||
instance = compute_api.get(context, server_id)
|
||||
except exception.NotFound():
|
||||
raise webob.exc.HTTPNotFound(_("Instance not found"))
|
||||
|
||||
|
@ -19,7 +19,6 @@ import unittest
|
||||
from lxml import etree
|
||||
|
||||
from nova.api.openstack import compute
|
||||
from nova.api.openstack.compute import extensions
|
||||
from nova.api.openstack.compute.contrib import server_diagnostics
|
||||
from nova.api.openstack import wsgi
|
||||
import nova.compute
|
||||
@ -28,11 +27,16 @@ from nova.tests.api.openstack import fakes
|
||||
import nova.utils
|
||||
|
||||
|
||||
UUID = 'abc'
|
||||
|
||||
|
||||
def fake_get_diagnostics(self, _context, instance_uuid):
|
||||
return {'data': 'Some diagnostic info'}
|
||||
|
||||
|
||||
def fake_instance_get(self, _context, instance_uuid):
|
||||
if instance_uuid != UUID:
|
||||
raise Exception("Invalid UUID")
|
||||
return {'uuid': instance_uuid}
|
||||
|
||||
|
||||
@ -48,8 +52,7 @@ class ServerDiagnosticsTest(test.TestCase):
|
||||
self.router = compute.APIRouter()
|
||||
|
||||
def test_get_diagnostics(self):
|
||||
uuid = nova.utils.gen_uuid()
|
||||
req = fakes.HTTPRequest.blank('/fake/servers/%s/diagnostics' % uuid)
|
||||
req = fakes.HTTPRequest.blank('/fake/servers/%s/diagnostics' % UUID)
|
||||
res = req.get_response(self.router)
|
||||
output = json.loads(res.body)
|
||||
self.assertEqual(output, {'data': 'Some diagnostic info'})
|
||||
|
Loading…
x
Reference in New Issue
Block a user