def test_run_sql_file_catalog_update(self): sql_file = os.path.join(os.path.dirname(inspect.getfile(self.__class__)),'test_catalog_update.sql') out_file = os.path.join(os.path.dirname(inspect.getfile(self.__class__)),'test_catalog_update.out') self.assertFalse(os.path.exists(out_file)) try: self.assertTrue(PSQL.run_sql_file_catalog_update(sql_file = sql_file, out_file = out_file)) self.assertTrue(os.path.exists(out_file)) with open(out_file, 'r') as f: output = f.read() self.assertIsNotNone(re.search('utility', output)) self.assertIsNotNone(re.search('DML', output)) finally: os.remove(out_file) self.assertFalse(os.path.exists(out_file))
def test_run_sql_file_catalog_update_with_additional_pgoptions(self): sql_file = os.path.join(os.path.dirname(inspect.getfile(self.__class__)),'test_catalog_update.sql') out_file = os.path.join(os.path.dirname(inspect.getfile(self.__class__)),'test_catalog_update.out') self.assertFalse(os.path.exists(out_file)) try: self.assertTrue(PSQL.run_sql_file_catalog_update(sql_file = sql_file, out_file = out_file, PGOPTIONS = "-c client_min_messages=log")) self.assertTrue(os.path.exists(out_file)) with open(out_file, 'r') as f: output = f.read() self.assertIsNotNone(re.search('utility', output)) self.assertIsNotNone(re.search('DML', output)) self.assertIsNotNone(re.search('log', output)) finally: os.remove(out_file) self.assertFalse(os.path.exists(out_file))
def test_run_sql_file_catalog_update(self): sql_file = os.path.join( os.path.dirname(inspect.getfile(self.__class__)), 'test_catalog_update.sql') out_file = os.path.join( os.path.dirname(inspect.getfile(self.__class__)), 'test_catalog_update.out') self.assertFalse(os.path.exists(out_file)) try: self.assertTrue( PSQL.run_sql_file_catalog_update(sql_file=sql_file, out_file=out_file)) self.assertTrue(os.path.exists(out_file)) with open(out_file, 'r') as f: output = f.read() self.assertIsNotNone(re.search('utility', output)) self.assertIsNotNone(re.search('DML', output)) finally: os.remove(out_file) self.assertFalse(os.path.exists(out_file))
def test_run_sql_file_catalog_update_with_additional_pgoptions(self): sql_file = os.path.join( os.path.dirname(inspect.getfile(self.__class__)), 'test_catalog_update.sql') out_file = os.path.join( os.path.dirname(inspect.getfile(self.__class__)), 'test_catalog_update.out') self.assertFalse(os.path.exists(out_file)) try: self.assertTrue( PSQL.run_sql_file_catalog_update( sql_file=sql_file, out_file=out_file, PGOPTIONS="-c client_min_messages=log")) self.assertTrue(os.path.exists(out_file)) with open(out_file, 'r') as f: output = f.read() self.assertIsNotNone(re.search('utility', output)) self.assertIsNotNone(re.search('DML', output)) self.assertIsNotNone(re.search('log', output)) finally: os.remove(out_file) self.assertFalse(os.path.exists(out_file))