예제 #1
0
 def test_i18n(self):
     stdout = self.useFixture(fixtures.StringStream('confstdout')).stream
     self.useFixture(mockpatch.Patch('sys.stdout', new=stdout))
     generator.generate(self.conffiles_i18n)
     stdout.flush()
     stdout.seek(0)
     lines = stdout.readlines()
     # Test we have group in the output
     self.assertIn('[i18n]\n', lines)
     # Test we have opt in the output
     self.assertIn('#i18n=i18n\n', lines)
     # Test we have help in the output
     self.assertIn('# helpful message (string value)\n', lines)
예제 #2
0
 def test_unicode(self):
     stdout = self.useFixture(fixtures.StringStream('confstdout')).stream
     self.useFixture(mockpatch.Patch('sys.stdout', new=stdout))
     generator.generate(self.conffiles_unicode)
     stdout.flush()
     stdout.seek(0)
     lines = stdout.readlines()
     # Test we have group in the output
     self.assertIn('[unicode_group]\n', lines)
     # Test we have opt in the output
     self.assertIn('#unicode_opt=unicode_default\n', lines)
     # Test we have help in the output
     self.assertIn(u'# helpful message with unicode char:'
                   u' \xE7\x94\xB5 (string value)\n', lines)
예제 #3
0
 def test_generate(self):
     stdout = self.useFixture(fixtures.StringStream('confstdout')).stream
     self.useFixture(mockpatch.Patch('sys.stdout', new=stdout))
     generator.generate(self.conffiles)
     stdout.flush()
     stdout.seek(0)
     lines = stdout.readlines()
     # Test we have group in the output
     self.assertIn('[DEFAULT]\n', lines)
     self.assertIn('[baar]\n', lines)
     self.assertIn('[bar]\n', lines)
     # Test we have opt in the output
     self.assertIn('#baa=<None>\n', lines)
     self.assertIn('#foo=<None>\n', lines)
     self.assertIn('#fblaa=fblaa\n', lines)
예제 #4
0
 def test_group_order(self):
     self.useFixture(mockpatch.Patch(
         'openstack.common.config.generator.print_group_opts',
         new=self.faux_print_group_opts))
     generator.generate(self.conffiles)
     self.assertEqual(['DEFAULT', 'baar', 'bar'], self.groups)