@@ -80,6 +80,29 @@ def test_transaction_execute_with_result(db, col, docs):
80
80
assert job3 .result ()['_key' ] == docs [1 ]['_key' ]
81
81
82
82
83
+ def test_transaction_execute_aql (db , col , docs ):
84
+ with db .begin_transaction (return_result = True , write = [col .name ]) as txn_db :
85
+ job1 = txn_db .aql .execute (
86
+ 'INSERT @data IN @@collection' ,
87
+ bind_vars = {'data' : docs [0 ], '@collection' : col .name })
88
+ job2 = txn_db .aql .execute (
89
+ 'INSERT @data IN @@collection' ,
90
+ bind_vars = {'data' : docs [1 ], '@collection' : col .name })
91
+ job3 = txn_db .aql .execute (
92
+ 'RETURN DOCUMENT(@@collection, @key)' ,
93
+ bind_vars = {'key' : docs [1 ]['_key' ], '@collection' : col .name })
94
+ jobs = txn_db .queued_jobs ()
95
+ assert jobs == [job1 , job2 , job3 ]
96
+ assert all (job .status () == 'pending' for job in jobs )
97
+
98
+ assert txn_db .queued_jobs () == [job1 , job2 , job3 ]
99
+ assert all (job .status () == 'done' for job in txn_db .queued_jobs ())
100
+ assert extract ('_key' , col .all ()) == extract ('_key' , docs [:2 ])
101
+
102
+ # Test successful results
103
+ assert extract ('_key' , job3 .result ()) == [docs [1 ]['_key' ]]
104
+
105
+
83
106
def test_transaction_execute_error_in_result (db , col , docs ):
84
107
txn_db = db .begin_transaction (timeout = 100 , sync = True )
85
108
txn_col = txn_db .collection (col .name )
0 commit comments