File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,21 @@ async def test_connection_execute(
26
26
assert len (conn_result .result ()) == number_database_records
27
27
28
28
29
+ async def test_connection_fetch (
30
+ psql_pool : ConnectionPool ,
31
+ table_name : str ,
32
+ number_database_records : int ,
33
+ ) -> None :
34
+ """Test that single connection can fetch queries."""
35
+ connection = await psql_pool .connection ()
36
+
37
+ conn_result = await connection .fetch (
38
+ querystring = f"SELECT * FROM { table_name } " ,
39
+ )
40
+ assert isinstance (conn_result , QueryResult )
41
+ assert len (conn_result .result ()) == number_database_records
42
+
43
+
29
44
async def test_connection_connection (
30
45
psql_pool : ConnectionPool ,
31
46
) -> None :
Original file line number Diff line number Diff line change @@ -49,6 +49,23 @@ async def test_pool_execute(
49
49
assert len (inner_result ) == number_database_records
50
50
51
51
52
+ async def test_pool_fetch (
53
+ psql_pool : ConnectionPool ,
54
+ table_name : str ,
55
+ number_database_records : int ,
56
+ ) -> None :
57
+ """Test that ConnectionPool can fetch queries."""
58
+ select_result = await psql_pool .fetch (
59
+ f"SELECT * FROM { table_name } " ,
60
+ )
61
+
62
+ assert type (select_result ) == QueryResult
63
+
64
+ inner_result = select_result .result ()
65
+ assert isinstance (inner_result , list )
66
+ assert len (inner_result ) == number_database_records
67
+
68
+
52
69
async def test_pool_connection (
53
70
psql_pool : ConnectionPool ,
54
71
) -> None :
Original file line number Diff line number Diff line change @@ -205,6 +205,21 @@ async def test_transaction_cursor(
205
205
assert isinstance (cursor , Cursor )
206
206
207
207
208
+ async def test_transaction_fetch (
209
+ psql_pool : ConnectionPool ,
210
+ table_name : str ,
211
+ number_database_records : int ,
212
+ ) -> None :
213
+ """Test that single connection can fetch queries."""
214
+ connection = await psql_pool .connection ()
215
+
216
+ async with connection .transaction () as transaction :
217
+ conn_result = await transaction .fetch (
218
+ querystring = f"SELECT * FROM { table_name } " ,
219
+ )
220
+ assert len (conn_result .result ()) == number_database_records
221
+
222
+
208
223
@pytest .mark .parametrize (
209
224
("insert_values" ),
210
225
[
You can’t perform that action at this time.
0 commit comments