def test_no_source(self):
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         warning=['No files to (re)indent'])
     self.assertStdOut(
         'No files to (re)indent\n')
Esempio n. 2
0
 def test_output_none(self):
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('invalid.cfg -q')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('')
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('source.cfg -qqqqqqq')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('')
 def test_output_none(self):
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('invalid.cfg -q')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('')
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('source.cfg -qqqqqqq')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('')
Esempio n. 4
0
 def test_multiple_sources(self):
     config_file = NamedTemporaryFile()
     config_file.write('[sections]\nKey=Value\n'.encode('utf-8'))
     config_file.seek(0)
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('%s invalid.cfg' % config_file.name)
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(warning=[
         '- %s (re)indented at 32 spaces.' %
         config_file.name, '- invalid.cfg cannot be read.'
     ])
     self.assertStdOut('- %s (re)indented at 32 spaces.\n'
                       '- invalid.cfg cannot be read.\n' % config_file.name)
 def test_multiple_sources(self):
     config_file = NamedTemporaryFile()
     config_file.write('[sections]\nKey=Value\n'.encode('utf-8'))
     config_file.seek(0)
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('%s invalid.cfg' % config_file.name)
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         warning=['- %s (re)indented at 32 spaces.' % config_file.name,
                  '- invalid.cfg cannot be read.'])
     self.assertStdOut(
         '- %s (re)indented at 32 spaces.\n'
         '- invalid.cfg cannot be read.\n' % config_file.name)
Esempio n. 6
0
 def test_simple(self):
     config_file = NamedTemporaryFile()
     config_file.write('[sections]\nKey=Value\n'.encode('utf-8'))
     config_file.seek(0)
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('%s' % config_file.name)
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         warning=['- %s (re)indented at 32 spaces.' % config_file.name])
     self.assertStdOut('- %s (re)indented at 32 spaces.\n' %
                       config_file.name)
     self.assertEquals(
         config_file.read().decode('utf-8'), '[sections]\n'
         'Key                             = Value\n')
     config_file.close()
 def test_simple(self):
     config_file = NamedTemporaryFile()
     config_file.write('[sections]\nKey=Value\n'.encode('utf-8'))
     config_file.seek(0)
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('%s' % config_file.name)
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         warning=['- %s (re)indented at 32 spaces.' % config_file.name])
     self.assertStdOut(
         '- %s (re)indented at 32 spaces.\n' % config_file.name)
     self.assertEquals(
         config_file.read().decode('utf-8'),
         '[sections]\n'
         'Key                             = Value\n')
     config_file.close()
Esempio n. 8
0
 def test_no_source(self):
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(warning=['No files to (re)indent'])
     self.assertStdOut('No files to (re)indent\n')
Esempio n. 9
0
 def test_invalid_source(self):
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('invalid.cfg')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(warning=['- invalid.cfg cannot be read.'])
     self.assertStdOut('- invalid.cfg cannot be read.\n')
Esempio n. 10
0
 def test_invalid_source(self):
     with self.assertRaises(SystemExit) as context:
         indent_buildout.cmdline('invalid.cfg')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(warning=['- invalid.cfg cannot be read.'])
     self.assertStdOut('- invalid.cfg cannot be read.\n')