Пример #1
0
async def test_open(unix_socket, open_unix_connection):
    conn = UnixConnection(unix_socket)

    reader, writer = await conn.open()

    assert reader
    assert writer
Пример #2
0
    async def test_open(self, *args):
        conn = UnixConnection(PATH)

        reader, writer = await conn.open()

        assert isinstance(reader, asyncio.StreamReader)
        assert isinstance(writer, asyncio.StreamWriter)
Пример #3
0
def test_connection_string(unix_socket):
    conn = UnixConnection(unix_socket)

    assert conn.connection_string == unix_socket
Пример #4
0
async def test_open_error(unix_socket, unix_os_error):
    conn = UnixConnection(unix_socket)

    with pytest.raises(AIOSpamcConnectionFailed):
        await conn.open()
Пример #5
0
async def test_open_refused(unix_socket, unix_connection_refused):
    conn = UnixConnection(unix_socket)

    with pytest.raises(AIOSpamcConnectionFailed):
        await conn.open()
Пример #6
0
def test_repr(unix_socket):
    conn = UnixConnection(unix_socket)

    assert repr(conn) == 'UnixConnection(path={})'.format(repr(unix_socket))
Пример #7
0
def test_instantiates_with_loop(unix_socket, event_loop):
    conn = UnixConnection(unix_socket, event_loop)

    assert conn.path is unix_socket
    assert conn.loop is event_loop
Пример #8
0
def test_instantiates(unix_socket):
    conn = UnixConnection(unix_socket)

    assert conn.path is unix_socket
Пример #9
0
    def test_connection_string(self):
        conn = UnixConnection(PATH)

        assert conn.connection_string == PATH
Пример #10
0
    async def test_open_error(self, *args):
        conn = UnixConnection(PATH)

        with pytest.raises(AIOSpamcConnectionFailed):
            reader, writer = await conn.open()
Пример #11
0
    def test_repr(self):
        conn = UnixConnection(PATH)

        assert repr(conn) == 'UnixConnection(path={})'.format(repr(PATH))
Пример #12
0
    def test_instantiates_with_loop(self, event_loop):
        conn = UnixConnection(PATH, event_loop)

        assert 'conn' in locals()
        assert conn.path is PATH
        assert conn.loop is event_loop
Пример #13
0
    def test_instantiates(self):
        conn = UnixConnection(PATH)

        assert 'conn' in locals()
        assert conn.path is PATH