diff --git a/ceilometer/tests/api.py b/ceilometer/tests/api.py index 33692aac2..36b377e36 100644 --- a/ceilometer/tests/api.py +++ b/ceilometer/tests/api.py @@ -27,6 +27,7 @@ from oslo.config import cfg import pecan import pecan.testing +from ceilometer.api import acl from ceilometer.api.v1 import app as v1_app from ceilometer.api.v1 import blueprint as v1_blueprint from ceilometer import storage @@ -40,6 +41,7 @@ class TestBase(db_test_base.TestBase): def setUp(self): super(TestBase, self).setUp() + cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) self.app = v1_app.make_app(cfg.CONF, enable_acl=False, attach_storage=False) @@ -79,6 +81,7 @@ class FunctionalTest(db_test_base.TestBase): def setUp(self): super(FunctionalTest, self).setUp() + cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) self.app = self._make_app() def _make_app(self, enable_acl=False): diff --git a/nova_tests/test_grizzly.py b/nova_tests/test_grizzly.py index e742a055a..b611590bc 100644 --- a/nova_tests/test_grizzly.py +++ b/nova_tests/test_grizzly.py @@ -39,14 +39,15 @@ from stevedore.tests import manager as test_manager ## alphabetical order, but they are in the order that actually ## works. Please don't change them. -from nova import config -from nova import db -from nova import context -from nova.tests import fake_network from nova.compute import vm_states -from nova.openstack.common.notifier import api as notifier_api +from nova.compute import instance_types +from nova import config +from nova import context +from nova import db from nova.openstack.common import importutils from nova.openstack.common import log as logging +from nova.openstack.common.notifier import api as notifier_api +from nova.tests import fake_network # For nova_CONF.compute_manager, used in the nova_notifier module. from nova import service @@ -136,6 +137,8 @@ class TestNovaNotifier(base.TestCase): self.stubs.Set(db, 'instance_update_and_get_original', lambda context, uuid, kwargs: (self.instance, self.instance)) + self.stubs.Set(instance_types, 'extract_instance_type', + lambda ref: {}) # Set up to capture the notification messages generated by the # plugin and to invoke our notifier plugin. diff --git a/tests/api/v1/test_app.py b/tests/api/v1/test_app.py index e64c20b83..c38356ac1 100644 --- a/tests/api/v1/test_app.py +++ b/tests/api/v1/test_app.py @@ -36,6 +36,7 @@ class TestApp(unittest.TestCase): def test_keystone_middleware_conf(self): cfg.CONF.set_override("auth_protocol", "foottp", group=acl.OPT_GROUP_NAME) + cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) api_app = app.make_app(cfg.CONF, attach_storage=False) self.assertEqual(api_app.wsgi_app.auth_protocol, 'foottp') @@ -43,6 +44,7 @@ class TestApp(unittest.TestCase): tmpfile = tempfile.mktemp() with open(tmpfile, "w") as f: f.write("[%s]\nauth_protocol = barttp" % acl.OPT_GROUP_NAME) + f.write("\nauth_version = v2.0") service.prepare_service(['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.make_app(cfg.CONF, attach_storage=False) diff --git a/tests/api/v2/test_app.py b/tests/api/v2/test_app.py index f3f8b5cd1..ebb9974f6 100644 --- a/tests/api/v2/test_app.py +++ b/tests/api/v2/test_app.py @@ -36,6 +36,7 @@ class TestApp(unittest.TestCase): def test_keystone_middleware_conf(self): cfg.CONF.set_override("auth_protocol", "foottp", group=acl.OPT_GROUP_NAME) + cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) api_app = app.setup_app() self.assertEqual(api_app.auth_protocol, 'foottp') @@ -43,6 +44,7 @@ class TestApp(unittest.TestCase): tmpfile = tempfile.mktemp() with open(tmpfile, "w") as f: f.write("[%s]\nauth_protocol = barttp" % acl.OPT_GROUP_NAME) + f.write("\nauth_version = v2.0") service.prepare_service(['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.setup_app()