ceph/teuthology/test/test_get_distro.py
Sandon Van Ness 810cca1daf Added get_distro() to misc.py
Since getting the ostype is used multiple places I made a
function for it and modified the existing code to use
said function. I also added tests for the function.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
2013-07-25 14:45:02 -07:00

30 lines
864 B
Python

from .. import misc as teuthology
class Mock: pass
class TestGetDistro(object):
def setup(self):
self.fake_ctx = Mock()
self.fake_ctx.config = {}
self.fake_ctx.os_type = 'ubuntu'
def test_default_distro(self):
distro = teuthology.get_distro(self.fake_ctx)
assert distro == 'ubuntu'
def test_argument(self):
self.fake_ctx.os_type = 'centos'
distro = teuthology.get_distro(self.fake_ctx)
assert distro == 'centos'
def test_teuth_config(self):
self.fake_ctx.config = {'os_type': 'fedora'}
distro = teuthology.get_distro(self.fake_ctx)
assert distro == 'fedora'
def test_teuth_config_downburst(self):
self.fake_ctx.config = {'downburst' : {'distro': 'sles'}}
distro = teuthology.get_distro(self.fake_ctx)
assert distro == 'sles'