本文整理汇总了Python中qgis.server.QgsServiceRegistry.unregisterService方法的典型用法代码示例。如果您正苦于以下问题:Python QgsServiceRegistry.unregisterService方法的具体用法?Python QgsServiceRegistry.unregisterService怎么用?Python QgsServiceRegistry.unregisterService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.server.QgsServiceRegistry
的用法示例。
在下文中一共展示了QgsServiceRegistry.unregisterService方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_1_unregister_services
# 需要导入模块: from qgis.server import QgsServiceRegistry [as 别名]
# 或者: from qgis.server.QgsServiceRegistry import unregisterService [as 别名]
def test_1_unregister_services(self):
reg = QgsServiceRegistry()
serv1 = MyService("TEST", "1.0a", "Hello")
serv2 = MyService("TEST", "1.0b", "Hello")
serv3 = MyService("TEST", "1.0c", "Hello")
reg.registerService(serv1)
reg.registerService(serv2)
reg.registerService(serv3)
# Check we get the default version
service = reg.getService("TEST")
self.assertEqual( service.version(), "1.0a" )
# Remove one service
removed = reg.unregisterService("TEST", "1.0a")
self.assertEqual( removed, 1 )
# Check that we get the highest version
service = reg.getService("TEST")
self.assertEqual( service.version(), "1.0c" )
# Remove all services
removed = reg.unregisterService("TEST")
self.assertEqual( removed, 2 )
# Check that there is no more services available
service = reg.getService("TEST")
self.assertIsNone(service)