diff options
| author | Justin Santa Barbara <justin@fathomdb.com> | 2011-03-22 21:14:26 -0700 |
|---|---|---|
| committer | Justin Santa Barbara <justin@fathomdb.com> | 2011-03-22 21:14:26 -0700 |
| commit | 45d28dfb035b4e219845d44e00073d70211e8175 (patch) | |
| tree | f6f92d85a6a4736f7584d1e350113d9142fbad10 /nova | |
| parent | 5c31b423ba5b5347aac62559c4e5c0a02f264213 (diff) | |
Fixed up unit tests and direct api that was also calling _serialize (naughty!)
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/api/direct.py | 4 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_limits.py | 16 |
2 files changed, 15 insertions, 5 deletions
diff --git a/nova/api/direct.py b/nova/api/direct.py index dfca250e0..153871e9f 100644 --- a/nova/api/direct.py +++ b/nova/api/direct.py @@ -206,7 +206,9 @@ class ServiceWrapper(wsgi.Controller): params = dict([(str(k), v) for (k, v) in params.iteritems()]) result = method(context, **params) if type(result) is dict or type(result) is list: - return self._serialize(result, req.best_match_content_type()) + content_type = req.best_match_content_type() + default_xmlns = self.get_default_xmlns(req) + return self._serialize(result, content_type, default_xmlns) else: return result diff --git a/nova/tests/api/openstack/test_limits.py b/nova/tests/api/openstack/test_limits.py index 05cfacc60..df367005d 100644 --- a/nova/tests/api/openstack/test_limits.py +++ b/nova/tests/api/openstack/test_limits.py @@ -136,10 +136,17 @@ class LimitsControllerTest(BaseLimitTestSuite): request = self._get_index_request("application/xml") response = request.get_response(self.controller) - expected = "<limits><rate/><absolute/></limits>" - body = response.body.replace("\n", "").replace(" ", "") + expected = parseString(""" + <limits + xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"> + <rate/> + <absolute/> + </limits> + """.replace(" ", "")) - self.assertEqual(expected, body) + body = parseString(response.body.replace(" ", "")) + + self.assertEqual(expected.toxml(), body.toxml()) def test_index_xml(self): """Test getting limit details in XML.""" @@ -148,7 +155,8 @@ class LimitsControllerTest(BaseLimitTestSuite): response = request.get_response(self.controller) expected = parseString(""" - <limits> + <limits + xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"> <rate> <limit URI="*" regex=".*" remaining="10" resetTime="0" unit="MINUTE" value="10" verb="GET"/> |
