class List_t(unittest.TestCase): @DaoConfig("DBSReader") def __init__(self, methodName='runTest'): super(List_t, self).__init__(methodName) data_location = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'test_data.pkl') self.data_provider = create_dbs_data_provider( data_type='transient', data_location=data_location) self.data = self.data_provider.get_file_data() def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.dao = FileList(self.logger, self.dbi, self.dbowner) def tearDown(self): """Clean-up all necessary parameters""" self.conn.close() def test01(self): """dao.Oracle.File.List: Basic""" result = self.dao.execute(self.conn, dataset=self.data[0]["dataset"]) self.assertEqual(strip_volatile_fields(result), self.data) def test02(self): """dao.Oracle.File.List: Basic""" result = self.dao.execute(self.conn, block_name=self.data[0]["block_name"]) self.assertEqual(strip_volatile_fields(result), self.data) def test03(self): """dao.Oracle.File.List: Basic""" result = self.dao.execute( self.conn, logical_file_name=self.data[0]["logical_file_name"]) self.assertEqual(strip_volatile_fields(result), self.data)
class List_t(unittest.TestCase): @DaoConfig("DBSReader") def __init__(self, methodName='runTest'): super(List_t,self).__init__(methodName) data_location = os.path.join(os.path.dirname(os.path.abspath(__file__)),'test_data.pkl') self.data_provider = create_dbs_data_provider(data_type='transient',data_location=data_location) self.data = self.data_provider.get_file_data() def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.dao = FileList(self.logger, self.dbi, self.dbowner) def tearDown(self): """Clean-up all necessary parameters""" self.conn.close() def test01(self): """dao.Oracle.File.List: Basic""" result = self.dao.execute(self.conn, dataset=self.data[0]["dataset"]) self.assertEqual(strip_volatile_fields(result), self.data) def test02(self): """dao.Oracle.File.List: Basic""" result = self.dao.execute(self.conn, block_name=self.data[0]["block_name"]) self.assertEqual(strip_volatile_fields(result), self.data) def test03(self): """dao.Oracle.File.List: Basic""" result = self.dao.execute(self.conn, logical_file_name=self.data[0]["logical_file_name"]) self.assertEqual(strip_volatile_fields(result), self.data)
def test11(self): """File.List""" from dbs.dao.Oracle.File.List import List as FileList dao = FileList(self.logger, self.dbi) print(dao.execute("/RelValQCD_Pt_80_120/CMSSW_3_1_3-MC_31X_V5-v1/GEN-SIM-RECO")) print(dao.execute("/SUT_11/SUT_PROCESSED_DATASET_V11/GEN-SIM-RECO")) dao.execute(block = "/RelValQCD_Pt_80_120/CMSSW_3_1_3-MC_31X_V5-v1/GEN-SIM-RECO#b110ad98-ab46-4f56-ad7c-ce762f2450c7")
def test11(self): """File.List""" from dbs.dao.Oracle.File.List import List as FileList dao = FileList(self.logger, self.dbi) print( dao.execute( "/RelValQCD_Pt_80_120/CMSSW_3_1_3-MC_31X_V5-v1/GEN-SIM-RECO")) print(dao.execute("/SUT_11/SUT_PROCESSED_DATASET_V11/GEN-SIM-RECO")) dao.execute( block= "/RelValQCD_Pt_80_120/CMSSW_3_1_3-MC_31X_V5-v1/GEN-SIM-RECO#b110ad98-ab46-4f56-ad7c-ce762f2450c7" )
def test01(self): """dao.Oracle.File.List: Basic""" conn = self.dbi.connection() dao = FileList(self.logger, self.dbi, self.dbowner) result = dao.execute(conn, dataset="*") self.assertTrue(type(result) == list) self.assertEqual(len(result), 0) result = dao.execute(conn, block_name='*') self.assertTrue(type(result) == list) self.assertEqual(len(result), 0) result = dao.execute(conn, logical_file_name='*') self.assertTrue(type(result) == list) self.assertEqual(len(result), 0) conn.close()