""" Tests for pika.base_connection.BaseConnection """ import socket import unittest import mock import pika import sys import ssl import pika.tcp_socket_opts from pika.adapters import base_connection # If this is missing, set it manually. We need it to test tcp opt setting. try: socket.TCP_KEEPIDLE except AttributeError: socket.TCP_KEEPIDLE = 4 class BaseConnectionTests(unittest.TestCase): def setUp(self): with mock.patch('pika.connection.Connection.connect'): self.connection = base_connection.BaseConnection() self.connection._set_connection_state( base_connection.BaseConnection.CONNECTION_OPEN) def test_repr(self): text = repr(self.connection) self.assertTrue(text.startswith('