@@ -263,6 +263,38 @@ def execute_once(content, words_count):
263
263
execute_once ('message6' , 60000 )
264
264
execute_once ('message8' , 80000 )
265
265
266
+ def test02_get_scripts (self ):
267
+ script_name , executable_name = 'ipfs_database_count' , 'database_count'
268
+ script_body = {'condition' : {
269
+ 'name' : 'verify_user_permission' ,
270
+ 'type' : 'queryHasResults' ,
271
+ 'body' : {
272
+ 'collection' : self .collection_name ,
273
+ 'filter' : {'author' : '$params.condition_author' }
274
+ }
275
+ }, 'executable' : {
276
+ 'name' : executable_name ,
277
+ 'type' : 'count' ,
278
+ 'body' : {
279
+ 'collection' : self .collection_name ,
280
+ 'filter' : {'author' : '$params.author' }
281
+ }
282
+ }}
283
+ self .__register_script (script_name , script_body )
284
+
285
+ # the check for 'get scripts'.
286
+ response = self .cli .get (f'/scripting/scripts' )
287
+ RA (response ).assert_status (200 )
288
+ scripts = RA (response ).body ().get ('scripts' , list )
289
+ self .assertEqual (len (scripts ), 1 )
290
+ script = DictAsserter (** scripts [0 ])
291
+ script .get ('executable' , dict ).assert_equal ('name' , executable_name )
292
+ script .get ('executable' , dict ).assert_equal ('type' , 'count' )
293
+ script .get ('executable' , dict ).get ('body' ).assert_equal ('collection' , self .collection_name )
294
+ script .get ('executable' , dict ).get ('body' , dict ).get ('filter' , dict ).assert_equal ('author' , '$params.author' )
295
+
296
+ self .delete_script (script_name )
297
+
266
298
def test02_count (self ):
267
299
script_name , executable_name = 'ipfs_database_count' , 'database_count'
268
300
script_body = {'executable' : {
0 commit comments