Example #1
0
 def testCreateCatalogDialogWithUrlWithoutProtocol(self):
     dialog = DefineCatalogDialog(self.explorer.catalogs())
     dialog.nameBox.setText("name")
     dialog.urlBox.setText(geoserverLocation()+"/geoserver")
     dialog.passwordBox.setText("password")
     dialog.usernameBox.setText("username")
     okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok)
     QTest.mouseClick(okWidget, Qt.LeftButton)
     self.assertTrue(dialog.ok)
     self.assertEquals("username", dialog.username)
     self.assertEquals("password", dialog.password)
     self.assertEquals("name", dialog.name)
     self.assertEquals("http://"+geoserverLocation()+"/geoserver/rest", dialog.url)
     settings = QSettings()
     settings.endGroup()
     settings.beginGroup("/GeoServer/Catalogs/name")
     settings.remove("")
     settings.endGroup()
 def testCreateCatalogDialogWithUrlWithoutProtocol(self):
     dialog = DefineCatalogDialog(self.explorer.catalogs())
     dialog.nameBox.setText("name")
     dialog.urlBox.setText(geoserverLocation()+"/geoserver")
     dialog.passwordBox.setText("password")
     dialog.usernameBox.setText("username")
     okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok)
     QTest.mouseClick(okWidget, Qt.LeftButton)
     self.assertTrue(dialog.ok)
     self.assertEquals("username", dialog.username)
     self.assertEquals("password", dialog.password)
     self.assertEquals("name", dialog.name)
     self.assertEquals("http://"+geoserverLocation()+"/geoserver/rest", dialog.url)
     settings = QSettings()
     settings.endGroup()
     settings.beginGroup("/GeoServer/Catalogs/name")
     settings.remove("")
     settings.endGroup()
Example #3
0
 def setUpClass(cls):
     cls.explorer = GeoServerExplorer()
     cls.cat = Catalog("http://"+geoserverLocation()+"/geoserver/rest", "admin", "geoserver")
     cleanCatalog(cls.cat)
     cls.cat.create_workspace(WORKSPACE, "http://test1.com")
     cls.cat.create_workspace(WORKSPACEB, "http://test2.com")
     # load project
     projectFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "test.qgs")
     if os.path.normcase(projectFile) != os.path.normcase(QgsProject.instance().fileName()):
         iface.addProject(projectFile)
def _openAndUpload():
    _loadTestData()
    layer = layerFromName("qgis_plugin_test_pt1")
    cat = _setUpCatalogAndWorkspace()
    catWrapper = CatalogWrapper(cat)
    catWrapper.publishLayer(layer, "test_workspace", True)
    stores = cat.get_stores("test_workspace")
    assert len(stores) != 0
    url = 'url=http://'+geoserverLocation()+'/geoserver/wms&format=image/png&layers=test_workspace:qgis_plugin_test_pt1&styles=qgis_plugin_test_pt1&crs=EPSG:4326'
    wmsLayer = QgsRasterLayer(url, "WMS", 'wms')
    assert wmsLayer.isValid()
    QgsMapLayerRegistry.instance().addMapLayer(wmsLayer)
    qgis.utils.iface.zoomToActiveLayer()
def _getCatalog():
    return RetryCatalog("http://"+geoserverLocation()+"/geoserver/rest", "admin", "geoserver")