Esempio n. 1
0
class TestArchiveCpio(object):
    def setup(self):
        self.archive = ArchiveCpio("foo.cpio")

    @patch("kiwi.archive_cpio.Command.run")
    def test_create(self, mock_command):
        self.archive.create("source-dir", ["/boot", "/var/cache"])
        find_command = "find . -path ./boot -prune -or -path ./var/cache -prune -o -print"
        cpio_command = "cpio --quiet -o -H newc"
        mock_command.assert_called_once_with(
            ["bash", "-c", "cd source-dir && " + find_command + " | " + cpio_command + " > foo.cpio"]
        )

    @patch("kiwi.archive_cpio.Command.run")
    def test_extract(self, mock_command):
        self.archive.extract("dest-dir")
        bash_command = "cd dest-dir && cat foo.cpio | cpio -i --make-directories"
        mock_command.assert_called_once_with(["bash", "-c", bash_command])
Esempio n. 2
0
class TestArchiveCpio(object):
    def setup(self):
        self.archive = ArchiveCpio('foo.cpio')

    @patch('kiwi.archive_cpio.Command.run')
    def test_create(self, mock_command):
        self.archive.create('source-dir', ['/boot', '/var/cache'])
        find_command = \
            'find . -path ./boot -prune -or -path ./var/cache -prune -o -print'
        cpio_command = 'cpio --quiet -o -H newc'
        mock_command.assert_called_once_with([
            'bash', '-c', 'cd source-dir && ' + find_command + ' | ' +
            cpio_command + ' > foo.cpio'
        ])

    @patch('kiwi.archive_cpio.Command.run')
    def test_extract(self, mock_command):
        self.archive.extract('dest-dir')
        bash_command = \
            'cd dest-dir && cat foo.cpio | cpio -i --make-directories'
        mock_command.assert_called_once_with(['bash', '-c', bash_command])
Esempio n. 3
0
 def setup(self):
     self.archive = ArchiveCpio("foo.cpio")
Esempio n. 4
0
 def setup(self):
     self.archive = ArchiveCpio('foo.cpio')