Test for missing database configuration message

The review of Iecf5006b32ca7bc2d46b7a59e78b4941a2e98122 identified that
the test for a missing [placement_database]/connection was not checking
that the exception raised was for the expected missing config. Now it
does.

Change-Id: If2f0ed3af762a39deaba9ec73e6c1aa8cac9f364
This commit is contained in:
Chris Dent 2018-09-14 15:10:52 -06:00
parent 5143fb8856
commit 4a843ddbb4
1 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
import testtools
from oslo_config import cfg
@ -27,6 +28,10 @@ class TestPlacementDBConf(testtools.TestCase):
self.conf_fixture = self.useFixture(config_fixture.Config(CONF))
def test_missing_config_raises(self):
self.assertRaises(
"""Not setting [placement_database]/connection is an error."""
exc = self.assertRaises(
cfg.RequiredOptError, self.conf_fixture.conf,
[], default_config_files=[])
self.assertIn(
'option connection in group [placement_database]',
six.text_type(exc))