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_primary_dataset_data() def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.dao = PrimaryDatasetList(self.logger, self.dbi, self.dbowner) def tearDown(self): """Clean-up all necessary parameters""" self.conn.close() def test01(self): """dao.Oracle.PrimaryDataset.List: Basic""" result = self.dao.execute(self.conn) self.assertTrue(isinstance(result, list)) def test02(self): """dao.Oracle.PrimaryDataset.List: Basic""" result = self.dao.execute(self.conn, primary_ds_name=self.data[0]['primary_ds_name']) self.assertEqual(strip_volatile_fields(result), self.data) def test03(self): """dao.Oracle.PrimaryDataset.List: Basic""" result = self.dao.execute(self.conn, "ThisDoesNotExist") self.assertTrue(type(result) == list) self.assertEqual(len(result), 0)
def test03(self): """PrimaryDataset.List""" from dbs.dao.Oracle.PrimaryDataset.List import List as PrimaryDatasetList dao = PrimaryDatasetList(self.logger, self.dbi) dao.execute() result = dao.execute("ThisDoesNotExist") self.assertEqual(len(result), 0)
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_primary_dataset_data() def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.dao = PrimaryDatasetList(self.logger, self.dbi, self.dbowner) def tearDown(self): """Clean-up all necessary parameters""" self.conn.close() def test01(self): """dao.Oracle.PrimaryDataset.List: Basic""" result = self.dao.execute(self.conn) self.assertTrue(isinstance(result, list)) def test02(self): """dao.Oracle.PrimaryDataset.List: Basic""" result = self.dao.execute( self.conn, primary_ds_name=self.data[0]['primary_ds_name']) self.assertEqual(strip_volatile_fields(result), self.data) def test03(self): """dao.Oracle.PrimaryDataset.List: Basic""" result = self.dao.execute(self.conn, "ThisDoesNotExist") self.assertTrue(type(result) == list) self.assertEqual(len(result), 0)
def test01(self): """dao.Oracle.PrimaryDataset.List: Basic""" conn = self.dbi.connection() dao = PrimaryDatasetList(self.logger, self.dbi, self.dbowner) dao.execute(conn) dao.execute(conn, primary_ds_name="*") result = dao.execute(conn, "ThisDoesNotExist") self.assertTrue(type(result) == list) self.assertEqual(len(result), 0) conn.close()
def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.dao = PrimaryDatasetList(self.logger, self.dbi, self.dbowner)