Properly initialize HostAddress
The HostAddress class wasn't calling super in it's __init__() method, which resulted in the type_name not being set properly for instances of that class. Change-Id: I4e589f2081e5d95227938cba9ad1158548bc1048 Closes-Bug: 1768498
This commit is contained in:
parent
96e9a3471a
commit
3e7eecc9f4
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
@ -1798,5 +1799,31 @@ class AdvancedOptionsTestCase(base.BaseTestCase):
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
|
||||
class HostAddressTestCase(base.BaseTestCase):
|
||||
|
||||
opts = [cfg.HostAddressOpt('foo', help='foo option', default='0.0.0.0')]
|
||||
|
||||
def test_host_address(self):
|
||||
|
||||
config = [("namespace", [("alpha", self.opts)])]
|
||||
groups = generator._get_groups(config)
|
||||
|
||||
out = moves.StringIO()
|
||||
formatter = generator._OptFormatter(output_file=out)
|
||||
generator._output_opts(formatter, 'alpha', groups.pop('alpha'))
|
||||
result = out.getvalue()
|
||||
|
||||
expected = textwrap.dedent('''
|
||||
[alpha]
|
||||
|
||||
#
|
||||
# From namespace
|
||||
#
|
||||
|
||||
# foo option (host address value)
|
||||
#foo = 0.0.0.0
|
||||
''').lstrip()
|
||||
self.assertEqual(expected, result)
|
||||
|
||||
GeneratorTestCase.generate_scenarios()
|
||||
MachineReadableGeneratorTestCase.generate_scenarios()
|
||||
|
@ -823,6 +823,7 @@ class HostAddress(ConfigType):
|
||||
|
||||
"""
|
||||
|
||||
super(HostAddress, self).__init__(type_name=type_name)
|
||||
self.ip_address = IPAddress(version, type_name)
|
||||
self.hostname = Hostname('localhost')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user