summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-20 18:08:33 +0000
committerGerrit Code Review <review@openstack.org>2013-05-20 18:08:33 +0000
commit1a966067e55101602e3331ab2bd02622fb0ab5d4 (patch)
treefa56e6a40a9e54850f4d224f6637781a232a3fc2 /nova/tests
parent5c3113b066e61cbc5d8d4d464f8200d4cb5e8395 (diff)
parent19aaaf5ee166ae0276a4bc00d8bfba1fb3c7fc57 (diff)
downloadnova-1a966067e55101602e3331ab2bd02622fb0ab5d4.tar.gz
nova-1a966067e55101602e3331ab2bd02622fb0ab5d4.tar.xz
nova-1a966067e55101602e3331ab2bd02622fb0ab5d4.zip
Merge "Fix require_context() decorators."
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_db_api.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index 130ed22af..dc2cf0d24 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -1177,6 +1177,22 @@ class DbApiTestCase(DbTestCase):
_compare(bw_usages[2], expected_bw_usages[2])
timeutils.clear_time_override()
+ def _test_decorator_wraps_helper(self, decorator):
+ def test_func():
+ """Test docstring."""
+
+ decorated_func = decorator(test_func)
+
+ self.assertEquals(test_func.func_name, decorated_func.func_name)
+ self.assertEquals(test_func.__doc__, decorated_func.__doc__)
+ self.assertEquals(test_func.__module__, decorated_func.__module__)
+
+ def test_require_context_decorator_wraps_functions_properly(self):
+ self._test_decorator_wraps_helper(sqlalchemy_api.require_context)
+
+ def test_require_admin_context_decorator_wraps_functions_properly(self):
+ self._test_decorator_wraps_helper(sqlalchemy_api.require_admin_context)
+
def _get_fake_aggr_values():
return {'name': 'fake_aggregate'}