def test_publish_csv(self): """Check that CSV publishing works like it should""" # Create a package p = self.add_package("test_publish_csv") # Create a resource p = self.add_resource(p["id"], {"package_id": p["id"], "url": "http://nothing.com/false.csv"}) # Do the Datastorer part resource_id = p.get("resources")[0]["id"] self.createTable(resource_id) # Assemble params for the publish function context = {"user": self.admin_user().name} params = { "package_id": p["id"], "resource_id": resource_id, "layer_name": "test-csv-publish-layer", "col_latitude": "lat", "col_longitude": "lng" } # Publish it via action response = publish(context, params) # Assertions gs = Geoserver.from_ckan_config() self.assertIsInstance(gs.get_layer("test-csv-publish-layer"), GeoserverLayer)
def test_publish_shapefile(self): """Check that Shapefile publishing works like it should""" # Create a package and resource package_name = "test_publish_shapefile" res = self.add_shapefile_resource(package_name) # Assemble params context = {"user": self.admin_user().name} params = { "package_id": package_name, "resource_id": res["id"], "layer_name": "test-shapefile-publish-layer", } # Publish it via action response = publish(context, params) # Assertions gs = Geoserver.from_ckan_config() self.assertIsInstance(gs.get_layer("test-shapefile-publish-layer"), GeoserverLayer)