From: Alfredo Deza Date: Thu, 28 Aug 2014 15:43:03 +0000 (-0400) Subject: add tests for the modifications of the utility X-Git-Tag: v1.5.13~3^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3bce3d5547045756b827988be67c4ff99e83deaa;p=ceph-deploy.git add tests for the modifications of the utility Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/tests/unit/hosts/test_centos.py b/ceph_deploy/tests/unit/hosts/test_centos.py index 5b3c65e..187582c 100644 --- a/ceph_deploy/tests/unit/hosts/test_centos.py +++ b/ceph_deploy/tests/unit/hosts/test_centos.py @@ -2,12 +2,17 @@ from ceph_deploy.hosts import centos from ceph_deploy import hosts from mock import Mock, patch + def pytest_generate_tests(metafunc): # called once per each test function - funcarglist = metafunc.cls.params[metafunc.function.__name__] + try: + funcarglist = metafunc.cls.params[metafunc.function.__name__] + except AttributeError: + return argnames = list(funcarglist[0]) metafunc.parametrize(argnames, [[funcargs[name] for name in argnames] - for funcargs in funcarglist]) + for funcargs in funcarglist]) + class TestCentosRepositoryUrlPart(object): @@ -38,7 +43,6 @@ class TestCentosRepositoryUrlPart(object): dict(distro="RedHat", release='10.9.8765', codename="Core", output='el10'), ] } - def make_fake_connection(self, platform_information=None): get_connection = Mock() diff --git a/ceph_deploy/tests/unit/hosts/test_util.py b/ceph_deploy/tests/unit/hosts/test_util.py new file mode 100644 index 0000000..c4a5947 --- /dev/null +++ b/ceph_deploy/tests/unit/hosts/test_util.py @@ -0,0 +1,29 @@ +from ceph_deploy.hosts import util +from mock import Mock + + +class TestInstallYumPriorities(object): + + def setup(self): + self.distro = Mock() + self.patch_path = 'ceph_deploy.hosts.centos.install.pkg_managers.yum' + self.yum = Mock() + + def test_centos_six(self): + self.distro.release = ('6', '0') + self.distro.normalized_name = 'centos' + util.install_yum_priorities(self.distro, _yum=self.yum) + assert self.yum.call_args[0][1] == 'yum-plugin-priorities' + + def test_centos_five(self): + self.distro.release = ('5', '0') + self.distro.normalized_name = 'centos' + util.install_yum_priorities(self.distro, _yum=self.yum) + assert self.yum.call_args[0][1] == 'yum-priorities' + + def test_fedora(self): + self.distro.release = ('20', '0') + self.distro.normalized_name = 'fedora' + util.install_yum_priorities(self.distro, _yum=self.yum) + assert self.yum.call_args[0][1] == 'yum-plugin-priorities' +