Skip to content
Permalink
Browse files

Add a test to create an Oracle 'createEmptyLayer'

  • Loading branch information
rduivenvoorde committed Nov 16, 2020
1 parent 31a0e72 commit 4f3a0808466074e46cd8b78519abbc5d2c308d11
Showing with 13 additions and 1 deletion.
  1. +13 −1 tests/src/python/test_provider_oracle.py
@@ -24,7 +24,10 @@
QgsFeature,
QgsGeometry,
QgsWkbTypes,
QgsDataProvider
QgsDataProvider,
QgsVectorLayerExporter,
QgsFields,
QgsCoordinateReferenceSystem
)

from qgis.PyQt.QtCore import QDate, QTime, QDateTime, QVariant
@@ -819,6 +822,15 @@ def testEvaluateDefaultValues(self):
attributes = [feat.attributes() for feat in vl.getFeatures()]
self.assertEqual(attributes, [[1, 'qgis'], [2, 'test'], [3, 'qgis'], [4, 'test']])

def testCreateEmptyLayer(self):
uri = self.dbconn + "srid=4326 type=POINT table=\"EMPTY_LAYER\" (GEOM)"
exporter = QgsVectorLayerExporter(uri=uri, provider='oracle', fields=QgsFields(), geometryType=QgsWkbTypes.Type.Point, crs=QgsCoordinateReferenceSystem(4326), overwrite=True)
self.assertEqual(exporter.errorCount(), 0)
self.assertEqual(exporter.errorCode(), 0)
# cleanup
self.execSQLCommand('DROP TABLE "QGIS"."EMPTY_LAYER"')
self.execSQLCommand("DELETE FROM user_sdo_geom_metadata where TABLE_NAME='EMPTY_LAYER'")


if __name__ == '__main__':
unittest.main()

0 comments on commit 4f3a080

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