def test_check_server_service_first_call_exception(self, pread, sleep): pread.side_effect=[util.CommandException(errno.EPIPE), " 100003 4,3,2 udp6,tcp6,udp,tcp nfs superuser"] service_found = nfs.check_server_service('aServer') self.assertTrue(service_found) self.assertEqual(len(pread.mock_calls), 2)
def test_check_server_service(self, pread, sleep): pread.side_effect=[" 100003 4,3,2 udp6,tcp6,udp,tcp nfs superuser"] service_found = nfs.check_server_service('aServer') self.assertTrue(service_found) self.assertEqual(len(pread.mock_calls), 1) pread.assert_called_with(['/usr/sbin/rpcinfo', '-s', 'aServer'])
def test_check_server_service_first_call_exception(self, pread, sleep): pread.side_effect = [ util.CommandException(errno.EPIPE), " 100003 4,3,2 udp6,tcp6,udp,tcp nfs superuser" ] service_found = nfs.check_server_service('aServer') self.assertTrue(service_found) self.assertEqual(len(pread.mock_calls), 2)
def test_check_server_service(self, pread, sleep): pread.side_effect = [ " 100003 4,3,2 udp6,tcp6,udp,tcp nfs superuser" ] service_found = nfs.check_server_service('aServer') self.assertTrue(service_found) self.assertEqual(len(pread.mock_calls), 1) pread.assert_called_with(['/usr/sbin/rpcinfo', '-s', 'aServer'])
def test_check_server_service_exception(self, pread, sleep): pread.side_effect = [util.CommandException(errno.ENOMEM)] with self.assertRaises(util.CommandException): nfs.check_server_service('aServer')
def test_check_server_service_not_available(self, pread, sleep): pread.return_value = "" service_found = nfs.check_server_service('aServer') self.assertFalse(service_found)
def test_check_server_service_exception(self, pread, sleep): pread.side_effect=[util.CommandException(errno.ENOMEM)] with self.assertRaises(util.CommandException): nfs.check_server_service('aServer')
def test_check_server_service_not_available(self, pread, sleep): pread.return_value="" service_found = nfs.check_server_service('aServer') self.assertFalse(service_found)
def test_check_server_service(self, pread): nfs.check_server_service('aServer') pread.assert_called_once_with(['/usr/sbin/rpcinfo', '-t', 'aServer', 'nfs'])