# Path: ceph_deploy/util/pkg_managers.py
# class PackageManager(object):
# class RPMManagerBase(PackageManager):
# class DNF(RPMManagerBase):
# class Yum(RPMManagerBase):
# class Apt(PackageManager):
# class Zypper(PackageManager):
# class Pacman(PackageManager):
# class AptRpm(PackageManager):
# class Swupd(PackageManager):
#     def __init__(self, remote_conn):
#     def _run(self, cmd, **kw):
#     def _check(self, cmd, **kw):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def add_repo_gpg_key(self, url):
#     def add_repo(self, name, url, **kw):
#     def remove_repo(self, name):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self, item=None):
#     def add_repo_gpg_key(self, url):
#     def add_repo(self, name, url, **kw):
#     def remove_repo(self, name):
#     def install(self, packages, **kw):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def add_repo_gpg_key(self, url):
#     def add_repo(self, name, url, **kw):
#     def remove_repo(self, name):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def add_repo_gpg_key(self, url):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):


from mock import patch, Mock
from ceph_deploy.util import pkg_managers
    def setup(self):
        self.to_patch = 'ceph_deploy.util.pkg_managers.remoto.process.run'

    def test_install_single_package(self):
        fake_run = Mock()
        with patch(self.to_patch, fake_run):
            pkg_managers.AptRpm(Mock()).install('vim')
            result = fake_run.call_args_list[-1]
        assert 'install' in result[0][-1]
        assert result[0][-1][-1] == 'vim'

    def test_install_multiple_packages(self):
        fake_run = Mock()
        with patch(self.to_patch, fake_run):
            pkg_managers.AptRpm(Mock()).install(['vim', 'zsh'])
            result = fake_run.call_args_list[-1]
        assert 'install' in result[0][-1]
        assert result[0][-1][-2:] == ['vim', 'zsh']

    def test_remove_single_package(self):
        fake_run = Mock()
        with patch(self.to_patch, fake_run):
            pkg_managers.AptRpm(Mock()).remove('vim')
            result = fake_run.call_args_list[-1]
        assert 'remove' in result[0][-1]
        assert result[0][-1][-1] == 'vim'

    def test_remove_multiple_packages(self):
        fake_run = Mock()
        with patch(self.to_patch, fake_run):

# Path: ceph_deploy/util/pkg_managers.py
# class PackageManager(object):
# class RPMManagerBase(PackageManager):
# class DNF(RPMManagerBase):
# class Yum(RPMManagerBase):
# class Apt(PackageManager):
# class Zypper(PackageManager):
# class Pacman(PackageManager):
# class AptRpm(PackageManager):
# class Swupd(PackageManager):
#     def __init__(self, remote_conn):
#     def _run(self, cmd, **kw):
#     def _check(self, cmd, **kw):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def add_repo_gpg_key(self, url):
#     def add_repo(self, name, url, **kw):
#     def remove_repo(self, name):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self, item=None):
#     def add_repo_gpg_key(self, url):
#     def add_repo(self, name, url, **kw):
#     def remove_repo(self, name):
#     def install(self, packages, **kw):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def add_repo_gpg_key(self, url):
#     def add_repo(self, name, url, **kw):
#     def remove_repo(self, name):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def add_repo_gpg_key(self, url):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):
#     def install(self, packages, **kw):
#     def remove(self, packages, **kw):
#     def clean(self):


# Path: ceph_deploy/tests/unit/util/test_pkg_managers.py
from mock import patch, Mock
from ceph_deploy.util import pkg_managers

    def setup(self):
        self.to_patch = 'ceph_deploy.util.pkg_managers.remoto.process.run'

    def test_install_single_package(self):
        fake_run = Mock()
        with patch(self.to_patch, fake_run):
            pkg_managers.AptRpm(Mock()).install('vim')
            result = fake_run.call_args_list[-1]
        assert 'install' in result[0][-1]
        assert result[0][-1][-1] == 'vim'

    def test_install_multiple_packages(self):
        fake_run = Mock()
        with patch(self.to_patch, fake_run):
            pkg_managers.AptRpm(Mock()).install(['vim', 'zsh'])
            result = fake_run.call_args_list[-1]
        assert 'install' in result[0][-1]
        assert result[0][-1][-2:] == ['vim', 'zsh']

    def test_remove_single_package(self):
        fake_run = Mock()
        with patch(self.to_patch, fake_run):
            pkg_managers.AptRpm(Mock()).remove('vim')
            result = fake_run.call_args_list[-1]
        assert 'remove' in result[0][-1]
        assert result[0][-1][-1] == 'vim'

    def test_remove_multiple_packages(self):
        fake_run = Mock()
        with patch(self.to_patch, fake_run):

            pkg_managers.AptRpm(Mock()).remove(['vim', 'zsh'])