예제 #1
0
 def test__extract(self):
     system_commands = []
     def fake_system(cmd):
         system_commands.append(cmd)
     original_system = os.system
     os.system = fake_system
     
     filenames = ['archive.001.xtm',
                  'archive.002.xtm',
                  'archive.003.xtm',]
     archive = XtmArchive('archive', './path', filenames)
     self.assertTrue(archive._extract())
     self.assertEquals(system_commands, [
         'dd if=./path/archive.001.xtm skip=1 ibs=104 status=noxfer > archive 2>/dev/null',
         'cat ./path/archive.002.xtm >> archive',
         'cat ./path/archive.003.xtm >> archive'])
     
     os.system = original_system
    def test__extract(self):
        system_commands = []

        def fake_system(cmd):
            system_commands.append(cmd)

        original_system = os.system
        os.system = fake_system

        filenames = ['archive.001.xtm', 'archive.002.xtm', 'archive.003.xtm']
        archive = XtmArchive('archive', './path', filenames)
        self.assertTrue(archive._extract())
        self.assertEquals(system_commands, [
            'dd if=./path/archive.001.xtm skip=1 ibs=104 '
            'status=noxfer > archive 2>/dev/null',
            'cat ./path/archive.002.xtm >> archive',
            'cat ./path/archive.003.xtm >> archive'
        ])

        os.system = original_system