kiwi-el8/test/unit/path_test.py
Marcus Schäfer 09daca60c0
KIWI - appliance builder next generation
a rewrite of the current kiwi from https://github.com/openSUSE/kiwi
2015-12-05 16:17:10 +01:00

46 lines
1.2 KiB
Python

from nose.tools import *
from mock import patch
import mock
import nose_helper
from kiwi.exceptions import *
from kiwi.path import Path
class TestPath(object):
def test_sort_by_hierarchy(self):
ordered = Path.sort_by_hierarchy(
['usr', 'usr/bin', 'etc', 'usr/lib']
)
assert ordered == ['usr', 'etc', 'usr/bin', 'usr/lib']
@patch('kiwi.command.Command.run')
def test_create(self, mock_command):
Path.create('foo')
mock_command.assert_called_once_with(
['mkdir', '-p', 'foo']
)
@patch('kiwi.command.Command.run')
def test_wipe(self, mock_command):
Path.wipe('foo')
mock_command.assert_called_once_with(
['rm', '-r', '-f', 'foo']
)
@patch('kiwi.command.Command.run')
def test_remove(self, mock_command):
Path.remove('foo')
mock_command.assert_called_once_with(
['rmdir', 'foo']
)
@patch('kiwi.command.Command.run')
def test_remove_hierarchy(self, mock_command):
Path.remove_hierarchy('foo')
mock_command.assert_called_once_with(
['rmdir', '-p', '--ignore-fail-on-non-empty', 'foo']
)