kiwi-el8/test/unit/repository/init_test.py
David Cassany 4b3a105026
Re-structure unit tests folders
This commit relocates unit tests to a folder structure that matches
the source code structure.

Fixes #1128
2019-10-21 14:00:05 +02:00

37 lines
1.2 KiB
Python

from mock import patch
from pytest import raises
import mock
from kiwi.repository import Repository
from kiwi.exceptions import KiwiRepositorySetupError
class TestRepository:
def test_repository_manager_not_implemented(self):
with raises(KiwiRepositorySetupError):
Repository('root_bind', 'ms-manager')
@patch('kiwi.repository.RepositoryZypper')
def test_repository_zypper(self, mock_manager):
root_bind = mock.Mock()
Repository(root_bind, 'zypper')
mock_manager.assert_called_once_with(root_bind, None)
@patch('kiwi.repository.RepositoryDnf')
def test_repository_dnf(self, mock_manager):
root_bind = mock.Mock()
Repository(root_bind, 'dnf')
mock_manager.assert_called_once_with(root_bind, None)
@patch('kiwi.repository.RepositoryDnf')
def test_repository_yum(self, mock_manager):
root_bind = mock.Mock()
Repository(root_bind, 'yum')
mock_manager.assert_called_once_with(root_bind, None)
@patch('kiwi.repository.RepositoryApt')
def test_repository_apt(self, mock_manager):
root_bind = mock.Mock()
Repository(root_bind, 'apt-get')
mock_manager.assert_called_once_with(root_bind, None)