@@ -92,7 +92,7 @@ local function check_insert(test, gql_wrapper, virtbox, mutation_insert,
92
92
-- check mutation result from graphql
93
93
local result = gql_mutation_insert :execute (dont_pass_variables and {} or
94
94
variables_insert )
95
- test :is_deeply (result , exp_result_insert , ' insert result' )
95
+ test :is_deeply (result . data , exp_result_insert , ' insert result' )
96
96
-- check inserted user
97
97
local tuple = get_tuple (virtbox , ' user_collection' , {user_id })
98
98
test :ok (tuple ~= nil , ' tuple was inserted' )
@@ -134,7 +134,7 @@ local function check_insert_order_metainfo(test, gql_wrapper, virtbox,
134
134
-- check mutation result
135
135
local gql_mutation_insert = gql_wrapper :compile (mutation_insert )
136
136
local result = gql_mutation_insert :execute (variables )
137
- test :is_deeply (result , exp_result_insert , ' insert result' )
137
+ test :is_deeply (result . data , exp_result_insert , ' insert result' )
138
138
139
139
-- check inserted tuple
140
140
local EXTERNAL_ID_STRING = 1 -- 0 is for int
@@ -218,7 +218,7 @@ local function check_update(test, gql_wrapper, virtbox, mutation_update,
218
218
-- check mutation result from graphql
219
219
local result = gql_mutation_update :execute (dont_pass_variables and {} or
220
220
variables_update )
221
- test :is_deeply (result , exp_result_update , ' update result' )
221
+ test :is_deeply (result . data , exp_result_update , ' update result' )
222
222
-- check updated user
223
223
local tuple = get_tuple (virtbox , ' user_collection' , {user_id })
224
224
test :ok (tuple ~= nil , ' updated tuple exists' )
@@ -282,7 +282,7 @@ local function check_update_order_metainfo(test, gql_wrapper, virtbox,
282
282
-- check mutation result
283
283
local gql_mutation_update = gql_wrapper :compile (mutation_update )
284
284
local result = gql_mutation_update :execute (variables )
285
- test :is_deeply (result , exp_result_update , ' update result' )
285
+ test :is_deeply (result . data , exp_result_update , ' update result' )
286
286
287
287
-- check updated tuple
288
288
local tuple = get_tuple (virtbox , ' order_metainfo_collection' ,
@@ -334,7 +334,7 @@ local function check_delete(test, gql_wrapper, virtbox, mutation_delete,
334
334
-- check mutation result from graphql
335
335
local result = gql_mutation_delete :execute (dont_pass_variables and {} or
336
336
variables_delete )
337
- test :is_deeply (result , exp_result_delete , ' delete result' )
337
+ test :is_deeply (result . data , exp_result_delete , ' delete result' )
338
338
339
339
-- check the user was deleted
340
340
local tuple = get_tuple (virtbox , ' user_collection' , {user_id })
@@ -468,10 +468,10 @@ local function run_queries(gql_wrapper, virtbox, meta)
468
468
}
469
469
]]
470
470
local gql_mutation_insert_3i = gql_wrapper :compile (mutation_insert_3i )
471
- local ok , err = pcall ( gql_mutation_insert_3i . execute ,
472
- gql_mutation_insert_3i , {} )
471
+ local result = gql_mutation_insert_3i : execute ({})
472
+ local err = test_utils . strip_error ( result . errors [ 1 ]. message )
473
473
local err_exp = ' "insert" must be the only argument when it is present'
474
- test :is_deeply ({ ok , test_utils . strip_error ( err )}, { false , err_exp } ,
474
+ test :is ( err , err_exp ,
475
475
' "insert" argument is forbidden with other filters (object arguments)' )
476
476
477
477
-- test "insert" argument is forbidden with list arguments
@@ -489,10 +489,10 @@ local function run_queries(gql_wrapper, virtbox, meta)
489
489
}
490
490
]]
491
491
local gql_mutation_insert_4i = gql_wrapper :compile (mutation_insert_4i )
492
- local ok , err = pcall ( gql_mutation_insert_4i . execute ,
493
- gql_mutation_insert_4i , {} )
492
+ local result = gql_mutation_insert_4i : execute ({})
493
+ local err = test_utils . strip_error ( result . errors [ 1 ]. message )
494
494
local err_exp = ' "insert" must be the only argument when it is present'
495
- test :is_deeply ({ ok , test_utils . strip_error ( err )}, { false , err_exp } ,
495
+ test :is ( err , err_exp ,
496
496
' "insert" argument is forbidden with other filters (list arguments)' )
497
497
498
498
-- test "insert" argument is forbidden with other extra argument
@@ -510,10 +510,10 @@ local function run_queries(gql_wrapper, virtbox, meta)
510
510
}
511
511
]]
512
512
local gql_mutation_insert_5i = gql_wrapper :compile (mutation_insert_5i )
513
- local ok , err = pcall ( gql_mutation_insert_5i . execute ,
514
- gql_mutation_insert_5i , {} )
513
+ local result = gql_mutation_insert_5i : execute ({})
514
+ local err = test_utils . strip_error ( result . errors [ 1 ]. message )
515
515
local err_exp = ' "insert" must be the only argument when it is present'
516
- test :is_deeply ({ ok , test_utils . strip_error ( err )}, { false , err_exp } ,
516
+ test :is ( err , err_exp ,
517
517
' "insert" argument is forbidden with other filters (extra arguments)' )
518
518
519
519
-- test inserting an object into a collection with subrecord, union, array
@@ -1134,11 +1134,11 @@ local function run_queries(gql_wrapper, virtbox, meta)
1134
1134
user_id = ' user_id_201' ,
1135
1135
}
1136
1136
}
1137
- local ok , err = pcall ( gql_mutation_update_4 . execute , gql_mutation_update_4 ,
1138
- variables_update_4 )
1137
+ local result = gql_mutation_update_4 : execute ( variables_update_4 )
1138
+ local err = test_utils . strip_error ( result . errors [ 1 ]. message )
1139
1139
local err_exp = " Attempt to modify a tuple field which is part of index " ..
1140
1140
" 'user_id_index' in space 'user_collection'"
1141
- test :is_deeply ({ ok , test_utils . strip_error ( err )}, { false , err_exp } ,
1141
+ test :is ( err , err_exp ,
1142
1142
' updating of a field of a primary key when it is NOT shard key field' )
1143
1143
1144
1144
local mutation_update_5 = [[
@@ -1159,11 +1159,11 @@ local function run_queries(gql_wrapper, virtbox, meta)
1159
1159
order_id = ' order_id_4001' ,
1160
1160
}
1161
1161
}
1162
- local ok , err = pcall ( gql_mutation_update_5 . execute , gql_mutation_update_5 ,
1163
- variables_update_5 )
1162
+ local result = gql_mutation_update_5 : execute ( variables_update_5 )
1163
+ local err = test_utils . strip_error ( result . errors [ 1 ]. message )
1164
1164
local err_exp = " Attempt to modify a tuple field which is part of index " ..
1165
1165
" 'order_id_index' in space 'order_collection'"
1166
- test :is_deeply ({ ok , test_utils . strip_error ( err )}, { false , err_exp } ,
1166
+ test :is ( err , err_exp ,
1167
1167
' updating of a field of a primary key when it is shard key field' )
1168
1168
1169
1169
-- }}}
0 commit comments