From: Owen Synge Date: Wed, 10 Aug 2016 14:58:31 +0000 (+0200) Subject: [RM-16979] Change test to use check function. X-Git-Tag: v1.5.35~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fbf4bf6e90daf16a2be976eb17cc1bfb49eb69f1;p=ceph-deploy.git [RM-16979] Change test to use check function. Check function testable in same way as run function. Signed-off-by: Owen Synge --- diff --git a/ceph_deploy/tests/unit/util/test_pkg_managers.py b/ceph_deploy/tests/unit/util/test_pkg_managers.py index b7c7976..1e4cedc 100644 --- a/ceph_deploy/tests/unit/util/test_pkg_managers.py +++ b/ceph_deploy/tests/unit/util/test_pkg_managers.py @@ -82,6 +82,7 @@ class TestZypper(object): def setup(self): self.to_patch = 'ceph_deploy.util.pkg_managers.remoto.process.run' + self.to_check = 'ceph_deploy.util.pkg_managers.remoto.process.check' def test_install_single_package(self): fake_run = Mock() @@ -100,18 +101,20 @@ class TestZypper(object): assert result[0][-1][-2:] == ['vim', 'zsh'] def test_remove_single_package(self): - fake_run = Mock() - with patch(self.to_patch, fake_run): + fake_check = Mock() + fake_check.return_value = '', '', 0 + with patch(self.to_check, fake_check): pkg_managers.Zypper(Mock()).remove('vim') - result = fake_run.call_args_list[-1] + result = fake_check.call_args_list[-1] assert 'remove' in result[0][-1] assert result[0][-1][-1] == 'vim' def test_remove_multiple_packages(self): - fake_run = Mock() - with patch(self.to_patch, fake_run): + fake_check = Mock() + fake_check.return_value = '', '', 0 + with patch(self.to_check, fake_check): pkg_managers.Zypper(Mock()).remove(['vim', 'zsh']) - result = fake_run.call_args_list[-1] + result = fake_check.call_args_list[-1] assert 'remove' in result[0][-1] assert result[0][-1][-2:] == ['vim', 'zsh']