示例#1
0
 def pub():
     if geoserver_layer_name is not None:
         l = Layer.publish(package_id, resource_id, geoserver_layer_name, username, lat_field=lat_field,
                           lng_field=lng_field)
         return l
     else:
         l = Layer.publish(package_id, resource_id, layer_name, username, lat_field=lat_field, lng_field=lng_field)
         return l
示例#2
0
    def test_create_layer(self):
        """Check that a layer exists once create_layer is called"""
        # Create a layer
        l = Layer(self._test_package["id"], self._test_resource["id"], "testing-layer", self.admin_user().name)

        # Push to Geoserver
        self.assertIsInstance(l.create_layer(), GeoserverLayer)

        # Check that the layer exists
        gs = Geoserver.from_ckan_config()
        self.assertIsInstance(gs.get_layer("testing-layer"), GeoserverLayer)
示例#3
0
    def test_create_layer(self):
        """Check that a layer exists once create_layer is called"""
        # Create a layer
        l = Layer(self._test_package["id"], self._test_resource["id"], "testing-layer", self.admin_user().name)

        # Push to Geoserver
        self.assertIsInstance(l.create_layer(), GeoserverLayer)

        # Check that the layer exists
        gs = Geoserver.from_ckan_config()
        self.assertIsInstance(gs.get_layer("testing-layer"), GeoserverLayer)
示例#4
0
    def test_remove_geo_resources(self):
        """Removing resources should get rid of only the "geo" resources"""
        # Create a layer
        l = Layer(self._test_package["id"], self._test_resource["id"], "testing-layer", self.admin_user().name)

        # Add resources
        l.create_geo_resources()

        # Remove resources
        l.remove_geo_resources()

        # Check what's left
        p = toolkit.get_action("package_show")(None, {"id": self._test_package_name})
        self.assertEqual(len(p["resources"]), 1)
示例#5
0
 def unpub():
     if geoserver_layer_name is not None:
         layer = Layer(geoserver=geoserver,
                       layer_name=geoserver_layer_name,
                       resource_id=resource_id,
                       package_id=package_id,
                       username=username)
         return layer
     else:
         layer = Layer(geoserver=geoserver,
                       layer_name=layer_name,
                       resource_id=resource_id,
                       package_id=package_id,
                       username=username)
         return layer
示例#6
0
    def test_remove_layer_resource_check(self):
        """Check that the file resource no longer includes a "layer_name" once remove_layer is called"""
        # Create a layer
        l = Layer(self._test_package["id"], self._test_resource["id"], "testing-layer", self.admin_user().name)

        # Push to Geoserver
        self.assertIsInstance(l.create_layer(), GeoserverLayer)

        # Remove the layer
        self.assertTrue(l.remove_layer())

        # Check the resource
        resource = toolkit.get_action("resource_show")(
            {"user": self.admin_user().name}, {"id": self._test_resource["id"]}
        )

        self.assertIsNone(resource.get("layer_name"))
示例#7
0
 def pub():
     if geoserver_layer_name is not None:
         l = Layer.publish(package_id,
                           resource_id,
                           geoserver_layer_name,
                           username,
                           lat_field=lat_field,
                           lng_field=lng_field)
         return l
     else:
         l = Layer.publish(package_id,
                           resource_id,
                           layer_name,
                           username,
                           lat_field=lat_field,
                           lng_field=lng_field)
         return l
示例#8
0
    def test_remove_layer_resource_check(self):
        """Check that the file resource no longer includes a "layer_name" once remove_layer is called"""
        # Create a layer
        l = Layer(self._test_package["id"], self._test_resource["id"], "testing-layer", self.admin_user().name)

        # Push to Geoserver
        self.assertIsInstance(l.create_layer(), GeoserverLayer)

        # Remove the layer
        self.assertTrue(l.remove_layer())

        # Check the resource
        resource = toolkit.get_action("resource_show")(
            {"user": self.admin_user().name},
            {"id": self._test_resource["id"]}
        )

        self.assertIsNone(resource.get("layer_name"))
示例#9
0
    def test_remove_geo_resources(self):
        """Removing resources should get rid of only the "geo" resources"""
        # Create a layer
        l = Layer(self._test_package["id"], self._test_resource["id"], "testing-layer", self.admin_user().name)

        # Add resources
        l.create_geo_resources()

        # Remove resources
        l.remove_geo_resources()

        # Check what's left
        p = toolkit.get_action("package_show")(None, {"id": self._test_package_name})
        self.assertEqual(len(p["resources"]), 1)
示例#10
0
 def test_create_geo_resources(self):
     """Creating WFS/WMS resources should return two resources"""
     l = Layer(self._test_package["id"], self._test_resource["id"],
               "testing-layer",
               self.admin_user().name)
     self.assertEqual(len(l.create_geo_resources()), 2)
示例#11
0
 def test_create_geo_resources(self):
     """Creating WFS/WMS resources should return two resources"""
     l = Layer(self._test_package["id"], self._test_resource["id"], "testing-layer", self.admin_user().name)
     self.assertEqual(len(l.create_geo_resources()), 2)