1717test_dataset = "/TTJets_mtop1695_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/RunIIWinter15GS-MCRUN2_71_V1-v1/GEN-SIM"
1818mongo_db_docker_url = "0.0.0.0:32774"
1919
20+
2021class ContextualStringIO (StringIO ):
2122 def __enter__ (self ):
2223 return self
@@ -40,7 +41,8 @@ def mock_make_x509_conn(url=reqmgr_url, max_try=5):
4041
4142
4243def mock_mongo_client ():
43- return pymongo .MongoClient ('mongodb://%s/' % mongo_db_docker_url )
44+ return pymongo .MongoClient ('mongodb://%s/' % mongo_db_docker_url )
45+
4446
4547class TestDeepUpdate (unittest .TestCase ):
4648
@@ -313,63 +315,63 @@ def testListCustodial(self):
313315 print response
314316 self .assertDictEqual (response ,
315317 {'T1_US_FNAL_MSS' : [2345013 ,
316- 2345083 ,
317- 2345230 ,
318- 2345350 ,
319- 2345586 ,
320- 2345858 ,
321- 2346380 ,
322- 2346956 ,
323- 2347154 ,
324- 2347520 ,
325- 2347851 ,
326- 2349029 ,
327- 2349077 ,
328- 2349378 ,
329- 2349379 ,
330- 2349684 ,
331- 2350365 ,
332- 2350577 ,
333- 2350849 ,
334- 2351209 ,
335- 2351236 ,
336- 2352060 ,
337- 2352170 ,
338- 2352228 ,
339- 2352416 ,
340- 2352695 ,
341- 2352781 ,
342- 2352859 ,
343- 2353136 ,
344- 2353137 ,
345- 2353267 ,
346- 2353341 ,
347- 2353361 ,
348- 2353408 ,
349- 2353415 ,
350- 2353500 ,
351- 2353597 ,
352- 2353796 ,
353- 2353830 ,
354- 2353952 ,
355- 2353963 ,
356- 2354169 ,
357- 2354231 ,
358- 2354415 ,
359- 2354580 ,
360- 2354583 ,
361- 2354684 ,
362- 2354922 ,
363- 2354937 ,
364- 2354988 ,
365- 2355007 ,
366- 2355246 ,
367- 2355284 ,
368- 2355657 ],
318+ 2345083 ,
319+ 2345230 ,
320+ 2345350 ,
321+ 2345586 ,
322+ 2345858 ,
323+ 2346380 ,
324+ 2346956 ,
325+ 2347154 ,
326+ 2347520 ,
327+ 2347851 ,
328+ 2349029 ,
329+ 2349077 ,
330+ 2349378 ,
331+ 2349379 ,
332+ 2349684 ,
333+ 2350365 ,
334+ 2350577 ,
335+ 2350849 ,
336+ 2351209 ,
337+ 2351236 ,
338+ 2352060 ,
339+ 2352170 ,
340+ 2352228 ,
341+ 2352416 ,
342+ 2352695 ,
343+ 2352781 ,
344+ 2352859 ,
345+ 2353136 ,
346+ 2353137 ,
347+ 2353267 ,
348+ 2353341 ,
349+ 2353361 ,
350+ 2353408 ,
351+ 2353415 ,
352+ 2353500 ,
353+ 2353597 ,
354+ 2353796 ,
355+ 2353830 ,
356+ 2353952 ,
357+ 2353963 ,
358+ 2354169 ,
359+ 2354231 ,
360+ 2354415 ,
361+ 2354580 ,
362+ 2354583 ,
363+ 2354684 ,
364+ 2354922 ,
365+ 2354937 ,
366+ 2354988 ,
367+ 2355007 ,
368+ 2355246 ,
369+ 2355284 ,
370+ 2355657 ],
369371 'T1_FR_CCIN2P3_MSS' : [1319254 ,
370- 1319259 ,
371- 1319315 ,
372- 1321435 ]})
372+ 1319259 ,
373+ 1319315 ,
374+ 1321435 ]})
373375
374376
375377class TestListSubscriptions (unittest .TestCase ):
@@ -818,13 +820,22 @@ def getresponse(self):
818820 response , [[{'name' : 'someSite' }, {'name' : 'someSite1' }]])
819821
820822
823+ class TestGetAllAgents (unittest .TestCase ):
824+ def test_getAllAgents (self ):
825+ from WmAgentScripts .utils import getBlockLocations as getAllAgents
826+
827+ with patch ('WmAgentScripts.utils.make_x509_conn' , mock_make_x509_conn ):
828+ response = getAllAgents (url = reqmgr_url , dataset = test_dataset )
829+ self .assertDictEqual (response , {})
830+
831+
821832class TestAgentSpeedDraining (unittest .TestCase ):
822833 def test_agent_speed_draining (self ):
823834 from WmAgentScripts .utils import agent_speed_draining
824835
825836 with patch ('WmAgentScripts.utils.mongo_client' , mock_mongo_client ):
826- response = agent_speed_draining ()
827- self .assertEqual (response , set ([u 'vocms0250.cern.ch' ]))
837+ response = agent_speed_draining ()
838+ self .assertEqual (response , set (['vocms0250.cern.ch' ]))
828839
829840
830841if __name__ == '__main__' :
0 commit comments