@@ -611,7 +611,7 @@ def test_submitJob(mocker, mockJWInput, expected):
611611 ("Pool/Singularity" , jobScript % "1" , (["Failed to find singularity" ], []), ([], [])),
612612 ],
613613)
614- def test_submitAndCheckJob (mocker , manageJobFiles , localCE , job , expectedResult1 , expectedResult2 ):
614+ def test_submitAndCheckJob (mocker , manageJobFiles , localCE , job , expectedResult1 , expectedResult2 , tmp_path ):
615615 """Test the submission and the management of the job status."""
616616 jobID = "123"
617617 jobExecutablePath , jobWrapperPath , jobWrapperConfigPath = manageJobFiles
@@ -635,7 +635,12 @@ def test_submitAndCheckJob(mocker, manageJobFiles, localCE, job, expectedResult1
635635 ),
636636 )
637637 mocker .patch ("DIRAC.WorkloadManagementSystem.Agent.JobAgent.JobAgent._sendFailoverRequest" , return_value = S_OK ())
638- mocker .patch ("DIRAC.Core.Security.X509Chain.X509Chain.dumpAllToString" , return_value = S_OK ())
638+ empty_file_path = tmp_path / "empty_file"
639+ empty_file_path .touch ()
640+ mocker .patch (
641+ "DIRAC.WorkloadManagementSystem.Agent.JobAgent.writeChainToTemporaryFile" ,
642+ return_value = S_OK (str (empty_file_path )),
643+ )
639644 mocker .patch (
640645 "DIRAC.Resources.Computing.SingularityComputingElement.SingularityComputingElement.submitJob" ,
641646 return_value = S_ERROR ("Failed to find singularity" ),
@@ -712,7 +717,7 @@ def test_submitAndCheckJob(mocker, manageJobFiles, localCE, job, expectedResult1
712717 assert len (jobAgent .computingElement .taskResults ) == 0
713718
714719
715- def test_submitAndCheck2Jobs (mocker ):
720+ def test_submitAndCheck2Jobs (mocker , tmp_path ):
716721 """Test the submission and the management of the job status.
717722
718723 This time, a first job is successfully submitted, but the second submission fails.
@@ -728,7 +733,17 @@ def test_submitAndCheck2Jobs(mocker):
728733 ),
729734 )
730735 mocker .patch ("DIRAC.WorkloadManagementSystem.Agent.JobAgent.JobAgent._sendFailoverRequest" , return_value = S_OK ())
731- mocker .patch ("DIRAC.Core.Security.X509Chain.X509Chain.dumpAllToString" , return_value = S_OK ())
736+
737+ def make_empty_file (* args , ** kwargs ):
738+ """Create an empty file and return its path."""
739+ empty_file_path = tmp_path / "empty_file"
740+ empty_file_path .touch ()
741+ return S_OK (str (empty_file_path ))
742+
743+ mocker .patch (
744+ "DIRAC.WorkloadManagementSystem.Agent.JobAgent.writeChainToTemporaryFile" ,
745+ make_empty_file ,
746+ )
732747 mocker .patch (
733748 "DIRAC.Resources.Computing.InProcessComputingElement.InProcessComputingElement.submitJob" ,
734749 side_effect = [S_OK (), S_ERROR ("ComputingElement error" )],
0 commit comments