From fbf4bf6e90daf16a2be976eb17cc1bfb49eb69f1 Mon Sep 17 00:00:00 2001 From: Owen Synge Date: Wed, 10 Aug 2016 16:58:31 +0200 Subject: [PATCH] [RM-16979] Change test to use check function. Check function testable in same way as run function. Signed-off-by: Owen Synge --- ceph_deploy/tests/unit/util/test_pkg_managers.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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'] -- 2.47.3