@@ -357,10 +357,20 @@ def test_post_create_entry(self):
357
357
# checks created jobs and its params are as expected
358
358
jobs = Job .objects .filter (user = user , target = entry )
359
359
job_expectations = [
360
- {"operation" : JobOperation .CREATE_ENTRY , "status" : Job .STATUS ["DONE" ]},
360
+ {
361
+ "operation" : JobOperation .CREATE_ENTRY ,
362
+ "status" : Job .STATUS ["DONE" ],
363
+ "dependent_job" : None ,
364
+ },
361
365
{
362
366
"operation" : JobOperation .NOTIFY_CREATE_ENTRY ,
363
367
"status" : Job .STATUS ["DONE" ],
368
+ "dependent_job" : None ,
369
+ },
370
+ {
371
+ "operation" : JobOperation .MAY_INVOKE_TRIGGER ,
372
+ "status" : Job .STATUS ["PREPARING" ],
373
+ "dependent_job" : jobs .get (operation = JobOperation .CREATE_ENTRY .value ),
364
374
},
365
375
]
366
376
self .assertEqual (jobs .count (), len (job_expectations ))
@@ -369,7 +379,7 @@ def test_post_create_entry(self):
369
379
self .assertEqual (obj .target .id , entry .id )
370
380
self .assertEqual (obj .target_type , Job .TARGET_ENTRY )
371
381
self .assertEqual (obj .status , expectation ["status" ])
372
- self .assertIsNone (obj .dependent_job )
382
+ self .assertEqual (obj .dependent_job , expectation [ "dependent_job" ] )
373
383
374
384
# checks specify part of attribute parameter then set AttributeValue
375
385
# which is only specified one
@@ -887,14 +897,25 @@ def test_post_edit_with_valid_param(self):
887
897
# checks created jobs and its params are as expected
888
898
jobs = Job .objects .filter (user = user , target = entry )
889
899
job_expectations = [
890
- {"operation" : JobOperation .EDIT_ENTRY , "status" : Job .STATUS ["DONE" ]},
900
+ {
901
+ "operation" : JobOperation .EDIT_ENTRY ,
902
+ "status" : Job .STATUS ["DONE" ],
903
+ "dependent_job" : None ,
904
+ },
891
905
{
892
906
"operation" : JobOperation .REGISTER_REFERRALS ,
893
907
"status" : Job .STATUS ["PREPARING" ],
908
+ "dependent_job" : None ,
894
909
},
895
910
{
896
911
"operation" : JobOperation .NOTIFY_UPDATE_ENTRY ,
897
912
"status" : Job .STATUS ["DONE" ],
913
+ "dependent_job" : None ,
914
+ },
915
+ {
916
+ "operation" : JobOperation .MAY_INVOKE_TRIGGER ,
917
+ "status" : Job .STATUS ["PREPARING" ],
918
+ "dependent_job" : jobs .get (operation = JobOperation .EDIT_ENTRY .value ),
898
919
},
899
920
]
900
921
self .assertEqual (jobs .count (), len (job_expectations ))
@@ -903,7 +924,7 @@ def test_post_edit_with_valid_param(self):
903
924
self .assertEqual (obj .target .id , entry .id )
904
925
self .assertEqual (obj .target_type , Job .TARGET_ENTRY )
905
926
self .assertEqual (obj .status , expectation ["status" ])
906
- self .assertIsNone (obj .dependent_job )
927
+ self .assertEqual (obj .dependent_job , expectation [ "dependent_job" ] )
907
928
908
929
# checks specify part of attribute parameter then set AttributeValue
909
930
# which is only specified one
@@ -5256,10 +5277,20 @@ def test_run_create_entry_task_duplicately(self):
5256
5277
# checks created jobs and its params are as expected
5257
5278
jobs = Job .objects .filter (user = user , target = entry )
5258
5279
job_expectations = [
5259
- {"operation" : JobOperation .CREATE_ENTRY , "status" : Job .STATUS ["DONE" ]},
5280
+ {
5281
+ "operation" : JobOperation .CREATE_ENTRY ,
5282
+ "status" : Job .STATUS ["DONE" ],
5283
+ "dependent_job" : None ,
5284
+ },
5260
5285
{
5261
5286
"operation" : JobOperation .NOTIFY_CREATE_ENTRY ,
5262
5287
"status" : Job .STATUS ["PREPARING" ],
5288
+ "dependent_job" : None ,
5289
+ },
5290
+ {
5291
+ "operation" : JobOperation .MAY_INVOKE_TRIGGER ,
5292
+ "status" : Job .STATUS ["PREPARING" ],
5293
+ "dependent_job" : jobs .get (operation = JobOperation .CREATE_ENTRY .value ),
5263
5294
},
5264
5295
]
5265
5296
self .assertEqual (jobs .count (), len (job_expectations ))
@@ -5268,7 +5299,7 @@ def test_run_create_entry_task_duplicately(self):
5268
5299
self .assertEqual (obj .target .id , entry .id )
5269
5300
self .assertEqual (obj .target_type , Job .TARGET_ENTRY )
5270
5301
self .assertEqual (obj .status , expectation ["status" ])
5271
- self .assertIsNone (obj .dependent_job )
5302
+ self .assertEqual (obj .dependent_job , expectation [ "dependent_job" ] )
5272
5303
5273
5304
# Rerun creating that entry job (This is core processing of this test)
5274
5305
job_create = Job .objects .get (user = user , operation = JobOperation .CREATE_ENTRY .value )
0 commit comments