Do not use nova.test in placement.test_deploy

The tests are very straightforward and do not require many of the setup
and fixtures that nova.test.NoDBTestCase supplies. Also, in the future
of placement extraction we don't want the dependecy.

One missing tool from NoDBTestCase is self.flags, which helps manage
configuration. That is a facade over CONF.set_override, so we just call
that instead.

Partially implements blueprint placement-extract

Change-Id: Ice6a42b3b8b94e155d7332256e9b568f80bc663d
This commit is contained in:
Chris Dent 2018-06-11 20:26:25 +01:00 committed by jichenjc
parent 288972be76
commit 1fc3e7d0fe

View File

@ -14,25 +14,25 @@
"""Unit tests for the deply function used to build the Placement service."""
from oslo_config import cfg
import testtools
import webob
from nova.api.openstack.placement import deploy
from nova import test
CONF = cfg.CONF
class DeployTest(test.NoDBTestCase):
class DeployTest(testtools.TestCase):
def test_auth_middleware_factory(self):
"""Make sure that configuration settings make their way to
the keystone middleware correctly.
"""
auth_uri = 'http://example.com/identity'
self.flags(auth_uri=auth_uri, group='keystone_authtoken')
CONF.set_override('auth_uri', auth_uri, group='keystone_authtoken')
# ensure that the auth_token middleware is chosen
self.flags(auth_strategy='keystone', group='api')
CONF.set_override('auth_strategy', 'keystone', group='api')
app = deploy.deploy(CONF)
req = webob.Request.blank('/resource_providers', method="GET")