Esempio n. 1
0
    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)
Esempio n. 2
0
    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'])
Esempio n. 3
0
    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)
Esempio n. 4
0
    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'])
Esempio n. 5
0
 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')
Esempio n. 6
0
    def test_check_server_service_not_available(self, pread, sleep):
        pread.return_value = ""

        service_found = nfs.check_server_service('aServer')

        self.assertFalse(service_found)
Esempio n. 7
0
 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')
Esempio n. 8
0
    def test_check_server_service_not_available(self, pread, sleep):
        pread.return_value=""

        service_found = nfs.check_server_service('aServer')

        self.assertFalse(service_found)
Esempio n. 9
0
    def test_check_server_service(self, pread):
        nfs.check_server_service('aServer')

        pread.assert_called_once_with(['/usr/sbin/rpcinfo', '-t', 
                                       'aServer', 'nfs'])