def test_50_pgds_Read(self): with PGDS(config()) as pgds: res = pgds.read(None) self.assertNotEqual(res, {}, 'No results from PG read') self.assertEqual( list(res.keys())[0][1], 'new_test_pt', 'Error matching PG layerlist keys')
class Test_10_PGDS(unittest.TestCase): def setUp(self): self.pgds = PGDS(config()) def tearDown(self): self.pgds = None def test_10_pgds_Init(self): self.assertNotEqual(self.pgds, None, 'PG DS not instantiated') def test_20_pgds_NormalConnect(self): self.pgds.connect() self.assertNotEqual(self.pgds.cur, None, 'PG Cursor not instantiated') self.pgds.disconnect() def test_30_pgds_ContextConnect(self): with PGDS(config()) as pgds: self.assertNotEqual(pgds.cur, None, 'PG context Cursor not instantiated') def test_40_pgds_ExecuteTF(self): with PGDS(config()) as pgds: res = pgds.execute('select 100', False) self.assertEqual(res, True, "Execute doesn't return success") def test_41_pgds_ExecuteRes(self): with PGDS(config()) as pgds: res = pgds.execute('select 200', True) self.assertEqual(res[0][0], 200, 'Execute returns wrong result') def test_50_pgds_Read(self): with PGDS(config()) as pgds: res = pgds.read(None) self.assertNotEqual(res, {}, 'No results from PG read') self.assertEqual( list(res.keys())[0][1], 'new_test_pt', 'Error matching PG layerlist keys')
def setUp(self): pgds = PGDS(config()) self.layerreader = LayerReader(initds(SFDS, 'CropRegions.shp'), pgds)
def test_41_pgds_ExecuteRes(self): with PGDS(config()) as pgds: res = pgds.execute('select 200', True) self.assertEqual(res[0][0], 200, 'Execute returns wrong result')
def test_40_pgds_ExecuteTF(self): with PGDS(config()) as pgds: res = pgds.execute('select 100', False) self.assertEqual(res, True, "Execute doesn't return success")
def test_30_pgds_ContextConnect(self): with PGDS(config()) as pgds: self.assertNotEqual(pgds.cur, None, 'PG context Cursor not instantiated')
def setUp(self): self.pgds = PGDS(config())