]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Update test_router_list to validate the router returned.
authorKyle Mestery <kmestery@cisco.com>
Fri, 14 Dec 2012 15:00:08 +0000 (15:00 +0000)
committerKyle Mestery <kmestery@cisco.com>
Sun, 16 Dec 2012 09:25:40 +0000 (09:25 +0000)
For unit test test_l3_plugin.L3NatExtensionTestCase.test_router_list,
correctly validate the value returned from listing the routers.

Fixes bug 1078150

Change-Id: I5ae559c37f43c1b977065a3508b6efb4375a2c1a

quantum/tests/unit/test_l3_plugin.py

index f628f733a4307fc299f0a15d7d2ec0a92b72a7c9..c093e674af31a9edee037bd3b03a16780628222e 100644 (file)
@@ -21,7 +21,7 @@ import contextlib
 import copy
 import itertools
 import logging
-import unittest
+import unittest2 as unittest
 
 import mock
 from webob import exc
@@ -141,6 +141,9 @@ class L3NatExtensionTestCase(unittest.TestCase):
         instance.get_routers.assert_called_with(mock.ANY, fields=mock.ANY,
                                                 filters=mock.ANY)
         self.assertEqual(res.status_int, exc.HTTPOk.code)
+        self.assertTrue('routers' in res.json)
+        self.assertEqual(1, len(res.json['routers']))
+        self.assertEqual(router_id, res.json['routers'][0]['id'])
 
     def test_router_update(self):
         router_id = _uuid()