import mon # noqa
import pkg # noqa
-from install import install, mirror_install, repo_install, repository_url_part # noqa
+from install import install, mirror_install, repo_install, repository_url_part, rpm_dist # noqa
from uninstall import uninstall # noqa
# Allow to set some information about this distro
from ceph_deploy.hosts import centos
from mock import Mock
-
-class TestCentosUrlPart(object):
+class TestCentosVersionDetection(object):
def setup(self):
self.distro = Mock()
self.distro.normalized_name = 'redhat'
self.distro.release = '7.0'
assert centos.repository_url_part(self.distro) == 'rhel7'
+
+ def test_rpm_dist_fallsback_to_el6(self):
+ self.distro.normalized_name = 'redhat'
+ self.distro.release = '3'
+ assert centos.rpm_dist(self.distro) == 'el6'
+
+ def test_rpm_dist_detects_rhel6(self):
+ self.distro.normalized_name = 'redhat'
+ self.distro.release = '6.6'
+ assert centos.rpm_dist(self.distro) == 'el6'
+
+ def test_rpm_dist_detects_rhel7(self):
+ self.distro.normalized_name = 'redhat'
+ self.distro.release = '7.0'
+ assert centos.rpm_dist(self.distro) == 'el7'