def test_instantiates_with_ssl(self): conn = TcpConnection(host=LOCALHOST, port=PORT, ssl=True) assert 'conn' in locals() assert conn.host is LOCALHOST assert conn.port is PORT assert conn.ssl is True
async def test_open(self, *args): conn = TcpConnection(host=LOCALHOST, port=PORT, ssl=False) reader, writer = await conn.open() assert isinstance(reader, asyncio.StreamReader) assert isinstance(writer, asyncio.StreamWriter)
async def test_open(address, open_connection): conn = TcpConnection(host=address[0], port=address[1]) reader, writer = await conn.open() assert writer assert writer
def test_instantiates_with_ssl(address, mocker): ssl_stub = mocker.stub() conn = TcpConnection(host=address[0], port=address[1], ssl=ssl_stub) assert conn.host is address[0] assert conn.port is address[1] assert conn.ssl is ssl_stub
def test_repr(address): conn = TcpConnection(host=address[0], port=address[1]) assert repr(conn) == 'TcpConnection(host={}, port={}, ssl={})'.format( repr(address[0]), repr(address[1]), repr(None) )
def test_instantiates_with_loop(address, event_loop): conn = TcpConnection(host=address[0], port=address[1], loop=event_loop) assert conn.host is address[0] assert conn.port is address[1] assert conn.loop is event_loop
def test_instantiates_with_loop(self, event_loop): conn = TcpConnection(host=LOCALHOST, port=PORT, ssl=False, loop=event_loop) assert 'conn' in locals() assert conn.host is LOCALHOST assert conn.port is PORT assert conn.loop is event_loop
def test_repr(self): conn = TcpConnection(host=LOCALHOST, port=PORT, ssl=False) assert repr(conn) == 'TcpConnection(host={}, port={}, ssl={})'.format( repr(LOCALHOST), repr(PORT), False)
def test_connection_string(self): conn = TcpConnection(host=LOCALHOST, port=PORT, ssl=False) assert conn.connection_string == '{}:{}'.format(LOCALHOST, PORT)
async def test_open_error(self, *args): conn = TcpConnection(host=LOCALHOST, port=PORT, ssl=False) with pytest.raises(AIOSpamcConnectionFailed): reader, writer = await conn.open()
def test_instantiates_without_ssl(address): conn = TcpConnection(host=address[0], port=address[1]) assert conn.host is address[0] assert conn.port is address[1] assert conn.ssl is None
def test_connection_string(address): conn = TcpConnection(host=address[0], port=address[1]) assert conn.connection_string == '{}:{}'.format(address[0], address[1])
async def test_open_error(address, os_error): conn = TcpConnection(host=address[0], port=address[1]) with pytest.raises(AIOSpamcConnectionFailed): reader, writer = await conn.open()