Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jan 16, 2023
1 parent 80e3f35 commit 5be8887
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
1 change: 1 addition & 0 deletions python/pyplugin_installer/installer.py
Expand Up @@ -661,6 +661,7 @@ def installFromZipFile(self, filePath):
plugins.getAllInstalled()
plugins.rebuild()

settings = QgsSettings()
if settings.contains('/PythonPlugins/' + pluginName): # Plugin was available?
if settings.value('/PythonPlugins/' + pluginName, False, bool): # Plugin was also active?
reloadPlugin(pluginName) # unloadPlugin + loadPlugin + startPlugin
Expand Down
2 changes: 1 addition & 1 deletion python/pyplugin_installer/installer_data.py
Expand Up @@ -811,7 +811,7 @@ def markNews(self):
seenPlugins = QgsSettings.createPluginTreeElement("_plugin_manager").childSetting("seen-plugins").valueWithDefaultOverride(list(self.mPlugins.keys()))
if len(seenPlugins) > 0:
for plugin in list(self.mPlugins.keys()):
if seenPlugins.count(plugin) == 0 and self.mPlugins[i]["status"] == "not installed":
if seenPlugins.count(plugin) == 0 and self.mPlugins[plugin]["status"] == "not installed":
self.mPlugins[plugin]["status"] = "new"

# ----------------------------------------- #
Expand Down
1 change: 0 additions & 1 deletion src/core/geocms/geonode/qgsgeonodeconnection.cpp
Expand Up @@ -13,7 +13,6 @@
* *
***************************************************************************/

#include "qgssettings.h"
#include "qgsgeonodeconnection.h"
#include "qgslogger.h"
#include "qgsdatasourceuri.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/locator/qgslocator.h
Expand Up @@ -154,7 +154,7 @@ class CORE_EXPORT QgsLocator : public QObject
QStringList completionList() const {return mAutocompletionList;}

#ifndef SIP_RUN
static inline QgsSettingsTreeNamedListElement *sTreeLocatorFilters = QgsSettings::sTreeQgis->createNamedListElement( QStringLiteral( "locator-filters" ) );
static inline QgsSettingsTreeNamedListElement *sTreeLocatorFilters = QgsSettings::treeRoot()->createNamedListElement( QStringLiteral( "locator-filters" ) );

//! Settings entry locator filter enabled
static const QgsSettingsEntryBool *settingsLocatorFilterEnabled;
Expand Down
22 changes: 11 additions & 11 deletions tests/src/python/test_qgsgeonodeconnection.py
Expand Up @@ -33,20 +33,20 @@ def setUpClass(cls):

# setup a fake connection
settings = QgsSettings()
key = QgsGeoNodeConnectionUtils.pathGeoNodeConnection() + '/test/'
key = f'/connections/ows/items/{QgsGeoNodeConnectionUtils.sGeoNodeConnection.lower()}/connections/items/test/'

settings.setValue(key + 'wms/referer', 'my_ref')
settings.setValue(key + 'wms/ignoreGetMapURI', True)
settings.setValue(key + 'wms/ignoreGetFeatureInfoURI', True)
settings.setValue(key + 'wms/smoothPixmapTransform', True)
settings.setValue(key + 'wms/dpiMode', 4)
settings.setValue(key + 'wms/ignoreAxisOrientation', True)
settings.setValue(key + 'wms/invertAxisOrientation', True)
settings.setValue(key + 'wms/http-header', {'referer': 'my_ref'})
settings.setValue(key + 'wms/ignore-get-map-uri', True)
settings.setValue(key + 'wms/ignore-get-feature-info-uri', True)
settings.setValue(key + 'wms/smooth-pixmap-transform', True)
settings.setValue(key + 'wms/dpi-mode', 4)
settings.setValue(key + 'wms/ignore-axis-orientation', True)
settings.setValue(key + 'wms/invert-axis-orientation', True)

settings.setValue(key + 'wfs/version', '1.1.0')
settings.setValue(key + 'wfs/maxnumfeatures', '47')
settings.setValue(key + 'wfs/ignoreAxisOrientation', True)
settings.setValue(key + 'wfs/invertAxisOrientation', True)
settings.setValue(key + 'wfs/max-num-features', '47')
settings.setValue(key + 'wfs/ignore-axis-orientation', True)
settings.setValue(key + 'wfs/invert-axis-orientation', True)

def testWmsConnection(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgslocator.py
Expand Up @@ -314,7 +314,7 @@ def got_hit(result):
l.deregisterFilter(filter_c)

# filter with custom prefix
QgsSettings().setValue("locator_filters/prefix_test_custom", 'xyz', QgsSettings.Gui)
QgsSettings().setValue("locator-filters/items/test_custom/prefix", 'xyz')
filter_c = test_filter('custom', 'abc')
l.registerFilter(filter_c)
self.assertEqual(filter_c.prefix(), 'abc')
Expand Down
30 changes: 15 additions & 15 deletions tests/src/python/test_qgsowsconnection.py
Expand Up @@ -32,22 +32,22 @@ def setUpClass(cls):

# setup some fake connections
settings = QgsSettings()
key = 'qgis/connections-wms/test/'
key = '/connections/ows/items/wms/connections/items/test/'
settings.setValue(key + 'url', 'aaa.bbb.com')
settings.setValue(key + 'referer', 'my_ref')
settings.setValue(key + 'ignoreGetMapURI', True)
settings.setValue(key + 'ignoreGetFeatureInfoURI', True)
settings.setValue(key + 'smoothPixmapTransform', True)
settings.setValue(key + 'dpiMode', 4)
settings.setValue(key + 'ignoreAxisOrientation', True)
settings.setValue(key + 'invertAxisOrientation', True)

key = 'qgis/connections-wfs/test/'
settings.setValue(key + 'http-header', {'referer': 'my_ref'})
settings.setValue(key + 'ignore-get-map-uri', True)
settings.setValue(key + 'ignore-get-feature-info-uri', True)
settings.setValue(key + 'smooth-pixmap-transform', True)
settings.setValue(key + 'dpi-mode', 4)
settings.setValue(key + 'ignore-axis-orientation', True)
settings.setValue(key + 'invert-axis-orientation', True)

key = '/connections/ows/items/wfs/connections/items/test/'
settings.setValue(key + 'url', 'ccc.ddd.com')
settings.setValue(key + 'version', '1.1.0')
settings.setValue(key + 'maxnumfeatures', '47')
settings.setValue(key + 'ignoreAxisOrientation', True)
settings.setValue(key + 'invertAxisOrientation', True)
settings.setValue(key + 'max-num-features', '47')
settings.setValue(key + 'ignore-axis-orientation', True)
settings.setValue(key + 'invert-axis-orientation', True)

def testWmsConnection(self):
c = QgsOwsConnection('WMS', 'test')
Expand All @@ -64,7 +64,7 @@ def testWmsConnection(self):

def testWmsSettings(self):
uri = QgsDataSourceUri()
QgsOwsConnection.addWmsWcsConnectionSettings(uri, 'qgis/connections-wms/test/')
QgsOwsConnection.addWmsWcsConnectionSettings(uri, 'wms', 'test')

self.assertEqual(uri.httpHeader('referer'), 'my_ref')
self.assertEqual(uri.param('IgnoreGetMapUrl'), '1')
Expand All @@ -86,7 +86,7 @@ def testWfsConnection(self):

def testWfsSettings(self):
uri = QgsDataSourceUri()
QgsOwsConnection.addWfsConnectionSettings(uri, 'qgis/connections-wfs/test/')
QgsOwsConnection.addWfsConnectionSettings(uri, 'wfs', 'test')

self.assertEqual(uri.param('version'), '1.1.0')
self.assertEqual(uri.param('maxNumFeatures'), '47')
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgssettings.py
Expand Up @@ -245,7 +245,7 @@ def test_origin(self):
self.assertEqual(self.settings.origin('undefined-key'), Qgis.SettingsOrigin.Any)

self.settings.setValue('testqgissettings/global/setting', 'rocks')
self.assertEqual(self.settings.origin('testqgissettings/global/setting'), Qgis.SettingsOrigin.Local)
self.assertEqual(self.settings.origin('testqgissettings/global/setting'), Qgis.SettingsOrigin.Global)

def test_group_section(self):
# Test group by using Section
Expand Down

0 comments on commit 5be8887

Please sign in to comment.