def test_get_osfamily(self): for distro_name in distro.DISTRO_NAMES: self.mock_os_release.return_value = {'ID': distro_name} variant = distro.name_to_distro(distro_name) family = distro.DISTRO_TO_OSFAMILY[variant] distro_obj = distro.get_osfamily() self.assertEqual(family, distro_obj)
def test_get_distro(self): for distro_name in distro.DISTRO_NAMES: self.mock_os_release.return_value = {'ID': distro_name} variant = distro.name_to_distro(distro_name) distro_obj = distro.get_distro() self.assertEqual(variant, distro_obj)
def test_name_to_distro_unknown_value(self): with self.assertRaises(ValueError): distro.name_to_distro(None)
def test_name_to_distro_unknown_attr(self): with self.assertRaises(ValueError): distro.name_to_distro('NotADistro')
def test_name_to_distro(self): for distro_name in distro.DISTRO_NAMES: dobj = distro.name_to_distro(distro_name) self.assertEqual(dobj, getattr(distro.DISTROS, distro_name))