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