Esempio n. 1
0
class FileManagerTest(unittest.TestCase):
    def setUp(self):
        self.cmd = ConvertCommand(None, None, None)
        self.samples = path(ResourceManager().resource_filename(
            __package__, "samples"))

    # pylint: disable-msg=W0212
    # Required for unit tests
    def test_create_backup(self):
        tmp = path(tempfile.mkdtemp())
        try:
            orig = tmp / "orig.txt"
            backup = tmp / "orig.txt~"

            orig.touch()
            self.assertTrue(orig.exists())
            self.assertFalse(backup.exists())
            self.cmd._create_backup(orig)
            self.assertTrue(backup.exists())
        finally:
            tmp.rmtree()
            self.assertFalse(tmp.exists())
Esempio n. 2
0
class FileManagerTest(unittest.TestCase):

    def setUp(self):
        self.cmd = ConvertCommand(None, None, None)
        self.samples = path(ResourceManager().resource_filename(__package__, "samples"))

    # pylint: disable-msg=W0212
    # Required for unit tests
    def test_create_backup(self):
        tmp = path(tempfile.mkdtemp())
        try:
            orig = tmp / "orig.txt"
            backup = tmp / "orig.txt~"
            
            orig.touch()
            self.assertTrue(orig.exists())
            self.assertFalse(backup.exists())
            self.cmd._create_backup(orig)
            self.assertTrue(backup.exists())
        finally:
            tmp.rmtree()
            self.assertFalse(tmp.exists())
            
Esempio n. 3
0
 def setUp(self):
     self.cmd = ConvertCommand(None, None, None)
     self.samples = path(ResourceManager().resource_filename(
         __package__, "samples"))
Esempio n. 4
0
 def setUp(self):
     self.cmd = ConvertCommand(None, None, None)
     self.samples = path(ResourceManager().resource_filename(__package__, "samples"))
Esempio n. 5
0
 def convert(self, charset, copy_to=None):
     self.charset = charset
     self.copy_to = copy_to
     return ConvertCommand(None, None, None)