Exemplo n.º 1
0
    def test_get_response_fail_s_close(self, mock_socket):
        mock_socket.recv.side_effect = (b'IDDQD', self.resp_body)
        mock_socket.close.side_effect = Exception

        zs = ZabbixSender()
        result = zs._get_response(mock_socket)
        self.assertFalse(result)
Exemplo n.º 2
0
    def test_get_response_fail_s_close(self, mock_socket):
        mock_socket.recv.side_effect = (b'IDDQD', self.resp_body)
        mock_socket.close.side_effect = Exception

        zs = ZabbixSender()
        result = zs._get_response(mock_socket)
        self.assertFalse(result)
Exemplo n.º 3
0
    def test_get_response(self, mock_socket):
        mock_socket.recv.side_effect = (self.resp_header, self.resp_body)

        zs = ZabbixSender()
        result = zs._get_response(mock_socket)
        mock_socket.recv.assert_has_calls([call(92)])
        self.assertEqual(result['response'], 'success')
Exemplo n.º 4
0
    def test_get_response(self, mock_socket):
        mock_socket.recv.side_effect = (self.resp_header, self.resp_body)

        zs = ZabbixSender()
        result = zs._get_response(mock_socket)
        mock_socket.recv.assert_has_calls([call(92)])
        self.assertEqual(result['response'], 'success')