@@ -219,35 +219,28 @@ def test_optional_handles_default_none(self):
219219
220220class TestWorkflowEdge :
221221 @pytest .mark .unit
222- def test_objectid_conversion (self ):
223- oid = uuid .uuid4 (). hex
222+ def test_uuid_id (self ):
223+ oid = str ( uuid .uuid4 ())
224224 e = WorkflowEdge (
225- _id = oid ,
226- id = "e1" ,
225+ id = oid ,
227226 workflow_id = "w1" ,
228227 source = "n1" ,
229228 target = "n2" ,
230229 )
231- assert e .mongo_id == str ( oid )
230+ assert e .id == oid
232231
233232 @pytest .mark .unit
234233 def test_string_id_passthrough (self ):
235234 e = WorkflowEdge (
236- _id = "string-id" ,
237- id = "e1" ,
235+ id = "string-id" ,
238236 workflow_id = "w1" ,
239237 source = "n1" ,
240238 target = "n2" ,
241239 )
242- assert e .mongo_id == "string-id"
243-
244- @pytest .mark .unit
245- def test_none_id (self ):
246- e = WorkflowEdge (id = "e1" , workflow_id = "w1" , source = "n1" , target = "n2" )
247- assert e .mongo_id is None
240+ assert e .id == "string-id"
248241
249242 @pytest .mark .unit
250- def test_to_mongo_doc (self ):
243+ def test_model_dump (self ):
251244 e = WorkflowEdge (
252245 id = "e1" ,
253246 workflow_id = "w1" ,
@@ -256,7 +249,7 @@ def test_to_mongo_doc(self):
256249 sourceHandle = "sh" ,
257250 targetHandle = "th" ,
258251 )
259- doc = e .to_mongo_doc ()
252+ doc = e .model_dump ()
260253 assert doc == {
261254 "id" : "e1" ,
262255 "workflow_id" : "w1" ,
@@ -303,15 +296,15 @@ def test_position_from_position_object(self):
303296
304297class TestWorkflowNode :
305298 @pytest .mark .unit
306- def test_objectid_conversion (self ):
307- oid = uuid .uuid4 (). hex
299+ def test_uuid_id (self ):
300+ oid = str ( uuid .uuid4 ())
308301 n = WorkflowNode (
309- _id = oid , id = "n1" , workflow_id = "w1" , type = NodeType .AGENT
302+ id = oid , workflow_id = "w1" , type = NodeType .AGENT
310303 )
311- assert n .mongo_id == str ( oid )
304+ assert n .id == oid
312305
313306 @pytest .mark .unit
314- def test_to_mongo_doc (self ):
307+ def test_model_dump (self ):
315308 n = WorkflowNode (
316309 id = "n1" ,
317310 workflow_id = "w1" ,
@@ -321,11 +314,11 @@ def test_to_mongo_doc(self):
321314 position = {"x" : 10 , "y" : 20 },
322315 config = {"key" : "val" },
323316 )
324- doc = n .to_mongo_doc ()
317+ doc = n .model_dump ()
325318 assert doc == {
326319 "id" : "n1" ,
327320 "workflow_id" : "w1" ,
328- "type" : "agent" ,
321+ "type" : NodeType . AGENT ,
329322 "title" : "My Node" ,
330323 "description" : "desc" ,
331324 "position" : {"x" : 10.0 , "y" : 20.0 },
@@ -354,14 +347,14 @@ def test_custom_values(self):
354347
355348class TestWorkflow :
356349 @pytest .mark .unit
357- def test_objectid_conversion (self ):
358- oid = uuid .uuid4 (). hex
359- w = Workflow (_id = oid )
360- assert w .id == str ( oid )
350+ def test_uuid_id (self ):
351+ oid = str ( uuid .uuid4 ())
352+ w = Workflow (id = oid )
353+ assert w .id == oid
361354
362355 @pytest .mark .unit
363356 def test_string_id (self ):
364- w = Workflow (_id = "abc" )
357+ w = Workflow (id = "abc" )
365358 assert w .id == "abc"
366359
367360 @pytest .mark .unit
@@ -378,9 +371,9 @@ def test_datetime_defaults(self):
378371 assert before <= w .updated_at <= after
379372
380373 @pytest .mark .unit
381- def test_to_mongo_doc (self ):
374+ def test_model_dump (self ):
382375 w = Workflow (name = "W" , description = "d" , user = "u1" )
383- doc = w .to_mongo_doc ()
376+ doc = w .model_dump ()
384377 assert doc ["name" ] == "W"
385378 assert doc ["description" ] == "d"
386379 assert doc ["user" ] == "u1"
@@ -525,13 +518,13 @@ def test_defaults(self):
525518 assert r .completed_at is None
526519
527520 @pytest .mark .unit
528- def test_objectid_conversion (self ):
529- oid = uuid .uuid4 (). hex
530- r = WorkflowRun (_id = oid , workflow_id = "w1" )
531- assert r .id == str ( oid )
521+ def test_uuid_id (self ):
522+ oid = str ( uuid .uuid4 ())
523+ r = WorkflowRun (id = oid , workflow_id = "w1" )
524+ assert r .id == oid
532525
533526 @pytest .mark .unit
534- def test_to_mongo_doc (self ):
527+ def test_model_dump (self ):
535528 now = datetime .now (timezone .utc )
536529 log = NodeExecutionLog (
537530 node_id = "n1" ,
@@ -546,9 +539,9 @@ def test_to_mongo_doc(self):
546539 outputs = {"a" : "world" },
547540 steps = [log ],
548541 )
549- doc = r .to_mongo_doc ()
542+ doc = r .model_dump ()
550543 assert doc ["workflow_id" ] == "w1"
551- assert doc ["status" ] == "running"
544+ assert doc ["status" ] == ExecutionStatus . RUNNING
552545 assert doc ["inputs" ] == {"q" : "hello" }
553546 assert doc ["outputs" ] == {"a" : "world" }
554547 assert len (doc ["steps" ]) == 1
0 commit comments