File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1066,7 +1066,7 @@ def get_workflows(
10661066 if input .workflow_id_prefix :
10671067 query = query .where (
10681068 SystemSchema .workflow_status .c .workflow_uuid .startswith (
1069- input .workflow_id_prefix
1069+ input .workflow_id_prefix , autoescape = True
10701070 )
10711071 )
10721072 if input .queue_name :
Original file line number Diff line number Diff line change @@ -198,6 +198,27 @@ def simple_workflow() -> None:
198198 assert len (output ) == 0 , f"Expected list length to be 0, but got { len (output )} "
199199
200200
201+ def test_list_workflow_prefix (dbos : DBOS ) -> None :
202+ @DBOS .workflow ()
203+ def simple_workflow () -> None :
204+ print ("Executed Simple workflow" )
205+ return
206+
207+ with SetWorkflowID ("test1" ):
208+ simple_workflow ()
209+ with SetWorkflowID ("test_" ):
210+ simple_workflow ()
211+
212+ output = DBOS .list_workflows (workflow_id_prefix = "invalid" )
213+ assert len (output ) == 0
214+ output = DBOS .list_workflows (workflow_id_prefix = "test" )
215+ assert len (output ) == 2
216+ output = DBOS .list_workflows (workflow_id_prefix = "test_" )
217+ assert len (output ) == 1
218+ output = DBOS .list_workflows (workflow_id_prefix = "test1" )
219+ assert len (output ) == 1
220+
221+
201222def test_list_workflow_end_times_positive (
202223 dbos : DBOS , skip_with_sqlite_imprecise_time : None
203224) -> None :
You can’t perform that action at this time.
0 commit comments