コード例 #1
0
ファイル: test_connection.py プロジェクト: jettify/aiogibson
 def test_connect_unixsocket(self):
     conn = yield from create_connection(self.gibson_socket, loop=self.loop)
     res = yield from conn.execute(b'ping')
     self.assertTrue(res)
     self.assertTrue(conn._loop, self.loop)
     conn.close()
     yield from conn.wait_closed()
コード例 #2
0
ファイル: test_connection.py プロジェクト: jettify/aiogibson
 def test_failed_to_decode(self):
     conn = yield from create_connection(self.gibson_socket, loop=self.loop)
     with self.assertRaises(LookupError):
         yield from conn.execute(b'set', 1, b'fo', b'bar',
                                 encoding='utf-10')
     conn.close()
     yield from conn.wait_closed()
コード例 #3
0
 def test_encoding_property(self):
     conn = yield from create_connection(self.gibson_socket,
                                         encoding='utf-8',
                                         loop=self.loop)
     self.assertEqual(conn.encoding, 'utf-8')
     conn.close()
     yield from conn.wait_closed()
コード例 #4
0
 def test_connect_unixsocket(self):
     conn = yield from create_connection(self.gibson_socket, loop=self.loop)
     res = yield from conn.execute(b'ping')
     self.assertTrue(res)
     self.assertTrue(conn._loop, self.loop)
     conn.close()
     yield from conn.wait_closed()
コード例 #5
0
ファイル: test_connection.py プロジェクト: jettify/aiogibson
 def test_cancel_futures_in_case_of_close(self):
     conn = yield from create_connection(self.gibson_socket, loop=self.loop)
     res1 = conn.execute(b'ping')
     res2 = conn.execute(b'ping')
     conn.close()
     yield from conn.wait_closed()
     self.assertTrue(res1.cancelled)
     self.assertTrue(res2.cancelled)
コード例 #6
0
ファイル: test_connection.py プロジェクト: jettify/aiogibson
 def test_cancel_future_loop(self):
     conn = yield from create_connection(self.gibson_socket, loop=self.loop)
     res = conn.execute(b'ping')
     res.cancel()
     res = yield from conn.execute(b'ping', encoding='utf-8')
     self.assertTrue(res)
     conn.close()
     yield from conn.wait_closed()
コード例 #7
0
ファイル: test_connection.py プロジェクト: jettify/aiogibson
 def test_global_loop(self):
     asyncio.set_event_loop(self.loop)
     conn = yield from create_connection(self.gibson_socket)
     res = yield from conn.execute(b'ping')
     self.assertTrue(conn._loop, self.loop)
     self.assertTrue(res)
     conn.close()
     yield from conn.wait_closed()
コード例 #8
0
 def test_cancel_futures_in_case_of_close(self):
     conn = yield from create_connection(self.gibson_socket, loop=self.loop)
     res1 = conn.execute(b'ping')
     res2 = conn.execute(b'ping')
     conn.close()
     yield from conn.wait_closed()
     self.assertTrue(res1.cancelled)
     self.assertTrue(res2.cancelled)
コード例 #9
0
 def test_cancel_future_loop(self):
     conn = yield from create_connection(self.gibson_socket, loop=self.loop)
     res = conn.execute(b'ping')
     res.cancel()
     res = yield from conn.execute(b'ping', encoding='utf-8')
     self.assertTrue(res)
     conn.close()
     yield from conn.wait_closed()
コード例 #10
0
 def test_global_loop(self):
     asyncio.set_event_loop(self.loop)
     conn = yield from create_connection(self.gibson_socket)
     res = yield from conn.execute(b'ping')
     self.assertTrue(conn._loop, self.loop)
     self.assertTrue(res)
     conn.close()
     yield from conn.wait_closed()
コード例 #11
0
 def test_failed_to_decode(self):
     conn = yield from create_connection(self.gibson_socket, loop=self.loop)
     with self.assertRaises(LookupError):
         yield from conn.execute(b'set',
                                 1,
                                 b'fo',
                                 b'bar',
                                 encoding='utf-10')
     conn.close()
     yield from conn.wait_closed()
コード例 #12
0
ファイル: test_connection.py プロジェクト: jettify/aiogibson
    def test_execute(self):
        conn = yield from create_connection(self.gibson_socket, loop=self.loop)
        res = yield from conn.execute(b'ping')
        self.assertTrue(res)

        with self.assertRaises(TypeError):
            yield from conn.execute(None)

        with self.assertRaises(TypeError):
            yield from conn.execute(b'set', None)
        conn.close()
        yield from conn.wait_closed()
コード例 #13
0
    def test_execute(self):
        conn = yield from create_connection(self.gibson_socket, loop=self.loop)
        res = yield from conn.execute(b'ping')
        self.assertTrue(res)

        with self.assertRaises(TypeError):
            yield from conn.execute(None)

        with self.assertRaises(TypeError):
            yield from conn.execute(b'set', None)
        conn.close()
        yield from conn.wait_closed()
コード例 #14
0
ファイル: test_connection.py プロジェクト: jettify/aiogibson
 def test_encoding_property(self):
     conn = yield from create_connection(self.gibson_socket,
                                         encoding='utf-8', loop=self.loop)
     self.assertEqual(conn.encoding, 'utf-8')
     conn.close()
     yield from conn.wait_closed()
コード例 #15
0
ファイル: test_connection.py プロジェクト: jettify/aiogibson
 def test_protocol_error(self):
     with self.assertRaises(ProtocolError):
         conn = yield from create_connection(self.gibson_socket,
                                             loop=self.loop)
         conn._parser.feed(b'\x06\x00\x05\x03\x00\x00\x00bar')
         yield from conn.execute(b'ping')
コード例 #16
0
 def test_protocol_error(self):
     with self.assertRaises(ProtocolError):
         conn = yield from create_connection(self.gibson_socket,
                                             loop=self.loop)
         conn._parser.feed(b'\x06\x00\x05\x03\x00\x00\x00bar')
         yield from conn.execute(b'ping')