]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Verify the full interface of the context object
authorIvan Kolodyazhny <e0ne@e0ne.info>
Mon, 22 Sep 2014 14:33:13 +0000 (17:33 +0300)
committerIvan Kolodyazhny <e0ne@e0ne.info>
Fri, 24 Oct 2014 16:25:54 +0000 (19:25 +0300)
Improved testcase for get_test_admin_context method
Change-Id: I8c99401150ed41cbf66b32cd00c7f8353ec4e267

cinder/tests/test_test_utils.py

index 6887913d775c165af1d5db55830e110c9bf6a407..8a9dbcd6660fc7c98074355c500061d025e5316d 100644 (file)
@@ -22,6 +22,22 @@ class TestUtilsTestCase(test.TestCase):
         """get_test_admin_context's return value behaves like admin context."""
         ctxt = test_utils.get_test_admin_context()
 
-        # TODO(soren): This should verify the full interface context
-        # objects expose.
+        self.assertIsNone(ctxt.project_id)
+        self.assertIsNone(ctxt.user_id)
+        self.assertIsNone(ctxt.domain)
+        self.assertIsNone(ctxt.project_domain)
+        self.assertIsNone(ctxt.user_domain)
+        self.assertIsNone(ctxt.project_name)
+        self.assertIsNone(ctxt.remote_address)
+        self.assertIsNone(ctxt.auth_token)
+        self.assertIsNone(ctxt.quota_class)
+
+        self.assertIsNotNone(ctxt.request_id)
+        self.assertIsNotNone(ctxt.timestamp)
+
+        self.assertEqual(['admin'], ctxt.roles)
+        self.assertEqual([], ctxt.service_catalog)
+        self.assertEqual('no', ctxt.read_deleted)
+
+        self.assertTrue(ctxt.read_deleted)
         self.assertTrue(ctxt.is_admin)