Skip to content
Permalink
Browse files

Add unit test for postgres layer metadata

  • Loading branch information
nyalldawson committed Mar 14, 2018
1 parent 7dd5caf commit feb20a7a2730236d33f0701da6da3dfd4399268a
Showing with 10 additions and 0 deletions.
  1. +8 −0 tests/src/python/test_provider_postgres.py
  2. +2 −0 tests/testdata/provider/testdata_pg.sql
@@ -37,6 +37,7 @@
QgsReadWriteContext,
QgsRectangle,
QgsDefaultValue,
QgsCoordinateReferenceSystem,
QgsProject,
QgsWkbTypes,
QgsGeometry
@@ -197,6 +198,13 @@ def test_table(dbconn, table_name, wkt):

test_table(self.dbconn, 'pt4d', 'PointZM (1 2 3 4)')

def testMetadata(self):
""" Test that metadata is correctly acquired from provider """
metadata = self.vl.metadata()
self.assertEqual(metadata.crs(), QgsCoordinateReferenceSystem.fromEpsgId(4326))
self.assertEqual(metadata.type(), 'dataset')
self.assertEqual(metadata.abstract(), 'QGIS Test Table')

def testGetFeaturesUniqueId(self):
"""
Test tables with inheritance for unique ids
@@ -43,6 +43,8 @@ CREATE TABLE qgis_test."someData" (
geom public.geometry(Point,4326)
);

COMMENT ON TABLE qgis_test."someData" IS 'QGIS Test Table';

CREATE TABLE qgis_test."some_poly_data" (
pk SERIAL NOT NULL,
geom public.geometry(Polygon,4326)

0 comments on commit feb20a7

Please sign in to comment.
You can’t perform that action at this time.