Skip to content

Commit

Permalink
fix provider connection test
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 authored and github-actions[bot] committed Jan 13, 2023
1 parent 9d3c87e commit e0fba97
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/src/python/test_qgsproviderconnection_base.py
Expand Up @@ -219,7 +219,11 @@ def _test_operations(self, md, conn):
self.assertIsNotNone(table_property)
self.assertEqual(table_property.tableName(), self.myNewTable)
self.assertEqual(table_property.geometryColumnCount(), 1)
self.assertEqual(table_property.geometryColumnTypes()[0].wkbType, QgsWkbTypes.LineString)

# with oracle line and curve have the same type, so it defaults to curve https://docs.oracle.com/database/121/SPATL/sdo_geometry-object-type.htm#SPATL494
line_wkb_type = QgsWkbTypes.LineString if self.providerKey != 'oracle' else QgsWkbTypes.CompoundCurve

self.assertEqual(table_property.geometryColumnTypes()[0].wkbType, line_wkb_type)
cols = table_property.geometryColumnTypes()
self.assertEqual(cols[0].crs, QgsCoordinateReferenceSystem.fromEpsgId(3857))
self.assertEqual(table_property.defaultName(), self.myNewTable)
Expand Down Expand Up @@ -391,22 +395,22 @@ def _test_operations(self, md, conn):
self.assertEqual(len(table.geometryColumnTypes()), 1)
ct = table.geometryColumnTypes()[0]
self.assertEqual(ct.crs, QgsCoordinateReferenceSystem.fromEpsgId(3857))
self.assertEqual(ct.wkbType, QgsWkbTypes.LineString)
self.assertEqual(ct.wkbType, line_wkb_type)
# Add a new (existing type)
table.addGeometryColumnType(QgsWkbTypes.LineString, QgsCoordinateReferenceSystem.fromEpsgId(3857))
table.addGeometryColumnType(line_wkb_type, QgsCoordinateReferenceSystem.fromEpsgId(3857))
self.assertEqual(len(table.geometryColumnTypes()), 1)
ct = table.geometryColumnTypes()[0]
self.assertEqual(ct.crs, QgsCoordinateReferenceSystem.fromEpsgId(3857))
self.assertEqual(ct.wkbType, QgsWkbTypes.LineString)
self.assertEqual(ct.wkbType, line_wkb_type)
# Add a new one
table.addGeometryColumnType(QgsWkbTypes.LineString, QgsCoordinateReferenceSystem.fromEpsgId(4326))
table.addGeometryColumnType(line_wkb_type, QgsCoordinateReferenceSystem.fromEpsgId(4326))
self.assertEqual(len(table.geometryColumnTypes()), 2)
ct = table.geometryColumnTypes()[0]
self.assertEqual(ct.crs, QgsCoordinateReferenceSystem.fromEpsgId(3857))
self.assertEqual(ct.wkbType, QgsWkbTypes.LineString)
self.assertEqual(ct.wkbType, line_wkb_type)
ct = table.geometryColumnTypes()[1]
self.assertEqual(ct.crs, QgsCoordinateReferenceSystem.fromEpsgId(4326))
self.assertEqual(ct.wkbType, QgsWkbTypes.LineString)
self.assertEqual(ct.wkbType, line_wkb_type)

# Check fields
fields = conn.fields(schema, self.myNewTable)
Expand Down

0 comments on commit e0fba97

Please sign in to comment.