Add test case for config generator hostname check
When I fixed the referenced bug I failed to add a unit test to cover the error case, so it's been up to the reviewers to make sure it doesn't regress. Let's give the reviewers a break and add a proper test case. Change-Id: I46c0f082acd9da6e84c7ac4d4cba387ec97c23c8 Related-Bug: #1205411
This commit is contained in:
parent
897aa7c42e
commit
f44691ee63
|
@ -104,6 +104,13 @@ class GeneratorTestcase(test.BaseTestCase):
|
|||
result = generator._sanitize_default('host', fake_fqdn)
|
||||
self.assertEqual('oslo', result)
|
||||
|
||||
def test_sanitize_value_matches_hostname(self):
|
||||
fake_hostname = 'foo'
|
||||
self.useFixture(fixtures.MonkeyPatch('socket.gethostname',
|
||||
lambda: fake_hostname))
|
||||
result = generator._sanitize_default('something', fake_hostname)
|
||||
self.assertEqual(fake_hostname, result)
|
||||
|
||||
def test_bad_lib(self):
|
||||
self.assertRaises(ImportError, generator.generate,
|
||||
['-l', 'broken_opts_lib'])
|
||||
|
|
Loading…
Reference in New Issue