Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
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')
Exemplo n.º 3
0
 def setUp(self):
     pgds = PGDS(config())
     self.layerreader = LayerReader(initds(SFDS, 'CropRegions.shp'), pgds)
Exemplo n.º 4
0
 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')
Exemplo n.º 5
0
 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")
Exemplo n.º 6
0
 def test_30_pgds_ContextConnect(self):
     with PGDS(config()) as pgds:
         self.assertNotEqual(pgds.cur, None,
                             'PG context Cursor not instantiated')
Exemplo n.º 7
0
 def setUp(self):
     self.pgds = PGDS(config())