def test_has_pkg_available_redhat_returns_false_not_avail(self, m_subp): pkg = 'wark' osfamily = distro.DISTROS.redhat m_subp.return_value = (pkg, '') result = distro.has_pkg_available(self.package, self.target, osfamily) self.assertEqual(pkg == self.package, result) m_subp.assert_has_calls([mock.call('list', opts=['--cacheonly'])])
def test_has_pkg_available_debian(self, m_subp): osfamily = distro.DISTROS.debian m_subp.return_value = (self.package, '') result = distro.has_pkg_available(self.package, self.target, osfamily) self.assertTrue(result) m_subp.assert_has_calls([ mock.call(['apt-cache', 'pkgnames'], capture=True, target=self.target) ])
def test_has_pkg_available_debian_returns_false_not_avail(self, m_subp): pkg = 'wark' osfamily = distro.DISTROS.debian m_subp.return_value = (pkg, '') result = distro.has_pkg_available(self.package, self.target, osfamily) self.assertEqual(pkg == self.package, result) m_subp.assert_has_calls([ mock.call(['apt-cache', 'pkgnames'], capture=True, target=self.target) ])
def test_has_pkg_available_redhat(self, m_subp): osfamily = distro.DISTROS.redhat m_subp.return_value = (self.package, '') result = distro.has_pkg_available(self.package, self.target, osfamily) self.assertTrue(result) m_subp.assert_has_calls([mock.call('list', opts=['--cacheonly'])])