def test_check_server(self): ''' Test for Check the real server exists in the specified service. ''' with patch.object(lvs, '__detect_os', return_value='C'): with patch.object(lvs, '_build_cmd', return_value='B'): with patch.dict(lvs.__salt__, {'cmd.run_all': MagicMock(return_value={'retcode': 'ret', 'stderr': 'stderr'})}): with patch.object(lvs, 'get_rules', return_value='C'): self.assertEqual(lvs.check_server('p', 's'), 'Error: server not exists')
def test_check_server(self): """ Test for Check the real server exists in the specified service. """ with patch.object(lvs, "__detect_os", return_value="C"): with patch.object(lvs, "_build_cmd", return_value="B"): with patch.dict( lvs.__salt__, { "cmd.run_all": MagicMock(return_value={ "retcode": "ret", "stderr": "stderr" }) }, ): with patch.object(lvs, "get_rules", return_value="C"): self.assertEqual(lvs.check_server("p", "s"), "Error: server not exists")