Skip to content

Commit

Permalink
Add a test to create an Oracle 'createEmptyLayer'
Browse files Browse the repository at this point in the history
  • Loading branch information
rduivenvoorde committed Nov 16, 2020
1 parent 31a0e72 commit 4f3a080
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/src/python/test_provider_oracle.py
Expand Up @@ -24,7 +24,10 @@
QgsFeature,
QgsGeometry,
QgsWkbTypes,
QgsDataProvider
QgsDataProvider,
QgsVectorLayerExporter,
QgsFields,
QgsCoordinateReferenceSystem
)

from qgis.PyQt.QtCore import QDate, QTime, QDateTime, QVariant
Expand Down Expand Up @@ -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.