Update unit test to reflect latest oslo.config
Because we added the default config_source opt in oslo.config, it is now showing up in the GMR output and needs to be included in the expected content. However, for lower constraints testing we also need to continue to support the older versions without config_source, so the target_str is built dynamically based on whether the opt exists. Change-Id: I20b01285000ce84b69e8bd3cee8078edf03616f8
This commit is contained in:
parent
8d49f91349
commit
98c0d2c1db
@ -94,6 +94,16 @@ class TestOpenstackGenerators(base.BaseTestCase):
|
||||
model = os_cgen.ConfigReportGenerator(conf)()
|
||||
model.set_current_view_type('text')
|
||||
|
||||
# oslo.config added a default config_source opt which gets included
|
||||
# in our output, but we also need to support older versions where that
|
||||
# wasn't the case. This logic can be removed once the oslo.config
|
||||
# lower constraint becomes >=6.4.0.
|
||||
config_source_line = ' config_source = \n'
|
||||
try:
|
||||
conf.config_source
|
||||
except cfg.NoSuchOptError:
|
||||
config_source_line = ''
|
||||
|
||||
target_str = ('\ncheese: \n'
|
||||
' from_cow = True\n'
|
||||
' group_secrets = ***\n'
|
||||
@ -101,8 +111,9 @@ class TestOpenstackGenerators(base.BaseTestCase):
|
||||
' sharpness = 1\n'
|
||||
'\n'
|
||||
'default: \n'
|
||||
'%s'
|
||||
' crackers = triscuit\n'
|
||||
' secrets = ***')
|
||||
' secrets = ***') % config_source_line
|
||||
self.assertEqual(target_str, six.text_type(model))
|
||||
|
||||
def test_package_report_generator(self):
|
||||
|
Loading…
Reference in New Issue
Block a user