Ejemplo n.º 1
0
 def test_broken_file(self):
     with helper.Capturing() as output:
         mscxyz.execute(['--config-file', ini_file, 'meta',
                         helper.get_tmpfile_path('broken.mscx')])
     self.assertTrue('Error: XMLSyntaxError; message: Start tag expected, '
                     '\'<\' not found, line 1, column 1' in
                     ' '.join(output))
Ejemplo n.º 2
0
    def test_version(self):
        with self.assertRaises(SystemExit):
            with helper.Capturing() as output:
                mscxyz.execute(["--version"])

        result = re.search("[^ ]* [^ ]*", output[0])
        self.assertTrue(result)
Ejemplo n.º 3
0
 def test_distribute_field_exception_unmatched(self):
     tmp = helper.get_tmpfile_path('simple.mscx')
     with helper.Capturing() as output:
         mscxyz.execute([
             'meta', '--distribute-field', 'vbox_title',
             '$metatag_work_title - $metatag_composer', tmp
         ])
     self.assertTrue('UnmatchedFormatStringError' in output[-1])
Ejemplo n.º 4
0
 def test_show_verbose_two(self):
     with helper.Capturing() as output:
         mscxyz.execute([
             '-vv', 'meta', '--clean', 'all',
             helper.get_tmpfile_path('simple.mscx')
         ])
     output = ' '.join(output)
     self.assertTrue('readonly_relpath_backup' in output)
Ejemplo n.º 5
0
 def test_show_verbose_one(self):
     with helper.Capturing() as output:
         mscxyz.execute([
             "-v", "meta", "--clean", "all",
             helper.get_tmpfile_path("simple.mscx")
         ])
     output = " ".join(output)
     self.assertTrue("readonly_abspath" in output)
     self.assertFalse("readonly_relpath_backup" in output)
Ejemplo n.º 6
0
 def test_broken_file(self):
     with helper.Capturing() as output:
         mscxyz.execute([
             "--config-file",
             ini_file,
             "meta",
             helper.get_tmpfile_path("broken.mscx"),
         ])
     self.assertTrue("Error: XMLSyntaxError; message: Start tag expected, "
                     "'<' not found, line 1, column 1" in " ".join(output))
Ejemplo n.º 7
0
    def test_show(self):
        with helper.Capturing() as output:
            mscxyz.execute([
                '--config-file', ini_file, 'meta', '--clean', 'all',
                helper.get_tmpfile_path('meta-all-values.mscx')
            ])

        self.assertEqual(output[0], '')
        self.assertTrue('meta-all-values.mscx' in ' '.join(output))
        self.assertEqual(output[-1], 'vbox_title: “vbox_title” -> “”')
Ejemplo n.º 8
0
 def test_show_simple_unverbose(self):
     with helper.Capturing() as output:
         mscxyz.execute([
             '--config-file', ini_file, 'meta', '--clean', 'all',
             helper.get_tmpfile_path('simple.mscx')
         ])
     self.assertEqual(output[0], '')
     self.assertTrue('simple.mscx' in ' '.join(output))
     self.assertEqual(output[2], 'combined_composer: “Composer” -> “”')
     self.assertEqual(output[3], 'combined_title: “Title” -> “”')
     self.assertEqual(output[-1], 'vbox_title: “Title” -> “”')
Ejemplo n.º 9
0
 def test_distribute_field_exception_unmatched(self):
     tmp = helper.get_tmpfile_path("simple.mscx")
     with helper.Capturing() as output:
         mscxyz.execute([
             "meta",
             "--distribute-field",
             "vbox_title",
             "$metatag_work_title - $metatag_composer",
             tmp,
         ])
     self.assertTrue("UnmatchedFormatStringError" in output[-1])
Ejemplo n.º 10
0
    def test_show(self):
        with helper.Capturing() as output:
            mscxyz.execute([
                "--config-file",
                ini_file,
                "meta",
                "--clean",
                "all",
                helper.get_tmpfile_path("meta-all-values.mscx"),
            ])

        self.assertEqual(output[0], "")
        self.assertTrue("meta-all-values.mscx" in " ".join(output))
        self.assertEqual(output[-1], "vbox_title: “vbox_title” -> “”")
Ejemplo n.º 11
0
 def test_show_simple_unverbose(self):
     with helper.Capturing() as output:
         mscxyz.execute([
             "--config-file",
             ini_file,
             "meta",
             "--clean",
             "all",
             helper.get_tmpfile_path("simple.mscx"),
         ])
     self.assertEqual(output[0], "")
     self.assertTrue("simple.mscx" in " ".join(output))
     self.assertEqual(output[2], "combined_composer: “Composer” -> “”")
     self.assertEqual(output[3], "combined_title: “Title” -> “”")
     self.assertEqual(output[-1], "vbox_title: “Title” -> “”")
Ejemplo n.º 12
0
 def test_help_text(self):
     with self.assertRaises(SystemExit):
         with helper.Capturing() as output:
             mscxyz.execute(["-h"])
     self.assertTrue("[-h]" in output[0])
Ejemplo n.º 13
0
 def test_functions_in_rename(self):
     with self.assertRaises(SystemExit):
         with helper.Capturing() as output:
             mscxyz.execute(['rename', '--help'])
     self.assertTrue('%asciify{text}' in '\n'.join(output))
Ejemplo n.º 14
0
 def test_help_short(self):
     with self.assertRaises(SystemExit) as cm:
         with helper.Capturing():
             mscxyz.execute(['-h'])
     the_exception = cm.exception
     self.assertEqual(str(the_exception), '0')
Ejemplo n.º 15
0
 def setUp(self):
     self.tmp = helper.get_tmpfile_path('simple.mscx')
     self.backup = self.tmp.replace('.mscx', '_bak.mscx')
     with helper.Capturing():
         mscxyz.execute(['--backup', 'meta', self.tmp])
Ejemplo n.º 16
0
 def _execute(args):
     with helper.Capturing() as output:
         mscxyz.execute(args)
     return output
Ejemplo n.º 17
0
 def test_markdown(self):
     with self.assertRaises(SystemExit):
         with helper.Capturing() as output:
             mscxyz.execute(["help", "--markdown", "all"])
     self.assertTrue("```" in output)
Ejemplo n.º 18
0
 def test_functions_in_rename(self):
     with self.assertRaises(SystemExit):
         with helper.Capturing() as output:
             mscxyz.execute(["rename", "--help"])
     self.assertTrue("%asciify{text}" in "\n".join(output))
Ejemplo n.º 19
0
 def test_help_long(self):
     with self.assertRaises(SystemExit) as cm:
         with helper.Capturing():
             mscxyz.execute(["--help"])
     the_exception = cm.exception
     self.assertEqual(str(the_exception), "0")
Ejemplo n.º 20
0
 def test_markdown(self):
     with self.assertRaises(SystemExit):
         with helper.Capturing() as output:
             mscxyz.execute(['help', '--markdown', 'all'])
     self.assertTrue('```' in output)
Ejemplo n.º 21
0
 def test_batch(self, Meta):
     with helper.Capturing():
         mscxyz.execute(["meta", helper.get_tmpdir_path("batch")])
     self.assertEqual(Meta.call_count, 3)
Ejemplo n.º 22
0
 def test_without_arguments(self):
     with self.assertRaises(SystemExit) as cm:
         with helper.Capturing("stderr"):
             mscxyz.execute()
     the_exception = cm.exception
     self.assertEqual(str(the_exception), "2")
Ejemplo n.º 23
0
 def test_all(self):
     with self.assertRaises(SystemExit):
         with helper.Capturing() as output:
             mscxyz.execute(["help", "all"])
     self.assertTrue(len(output) > 150)
Ejemplo n.º 24
0
 def test_restructuredtext(self):
     with self.assertRaises(SystemExit):
         with helper.Capturing() as output:
             mscxyz.execute(["help", "--rst", "all"])
     self.assertTrue(".. code-block:: text" in output)
Ejemplo n.º 25
0
 def setUp(self):
     self.tmp = helper.get_tmpfile_path("simple.mscx")
     self.backup = self.tmp.replace(".mscx", "_bak.mscx")
     with helper.Capturing():
         mscxyz.execute(["--backup", "meta", self.tmp])
Ejemplo n.º 26
0
 def test_restructuredtext(self):
     with self.assertRaises(SystemExit):
         with helper.Capturing() as output:
             mscxyz.execute(['help', '--rst', 'all'])
     self.assertTrue('.. code-block:: text' in output)