Skip to content

Commit

Permalink
Remove obsolete invalid XML characters test
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Nov 2, 2023
1 parent 8789639 commit 9cbb32b
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions tests/src/python/test_provider_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -2119,41 +2119,6 @@ def testStyleWithGeometryType(self):
ids = styles[1]
self.assertEqual(len(ids), 0)

def testSaveStyleInvalidXML(self):

self.execSQLCommand('DROP TABLE IF EXISTS layer_styles CASCADE')

vl = self.getEditableLayer()
self.assertTrue(vl.isValid())
self.assertEqual(int(vl.dataProvider().styleStorageCapabilities()) & Qgis.ProviderStyleStorageCapability.LoadFromDatabase, Qgis.ProviderStyleStorageCapability.LoadFromDatabase)
self.assertEqual(int(vl.dataProvider().styleStorageCapabilities()) & Qgis.ProviderStyleStorageCapability.SaveToDatabase, Qgis.ProviderStyleStorageCapability.SaveToDatabase)
self.assertEqual(int(vl.dataProvider().styleStorageCapabilities()) & Qgis.ProviderStyleStorageCapability.DeleteFromDatabase, Qgis.ProviderStyleStorageCapability.DeleteFromDatabase)

mFilePath = QDir.toNativeSeparators(
f"{unitTestDataPath()}/symbol_layer/fontSymbol.qml")
status = vl.loadNamedStyle(mFilePath)
self.assertTrue(status)

errorMsg = vl.saveStyleToDatabase(
"fontSymbol", "font with invalid utf8 char", False, "")
self.assertEqual(errorMsg, "")

qml, errmsg = vl.getStyleFromDatabase("1")
self.assertEqual(errmsg, "")

found = False
for line in qml.split('\n'):
found = 'value="\u001E"' in qml and 'name="chr"' in qml
if found:
break
self.assertTrue(found, f"record separator character (\u001E) not found in qml: {qml}")

# Test loadStyle from metadata
md = QgsProviderRegistry.instance().providerMetadata('postgres')
qml = md.loadStyle(self.dbconn + " type=POINT table=\"qgis_test\".\"editData\" (geom)", 'fontSymbol')
self.assertTrue(qml.startswith('<!DOCTYPE qgi'), qml)
self.assertTrue('value="\u001E"' in qml)

def testHasMetadata(self):
# views don't have metadata
vl = QgsVectorLayer(f"{self.dbconn} table=\"qgis_test\".\"bikes_view\" key=\"pk\" sql=", "bikes_view",
Expand Down

0 comments on commit 9cbb32b

Please sign in to comment.