예제 #1
0
 def setUp(self):
     cfg = ConfigParser.SafeConfigParser()
     cfg.read((os.path.join(TEST_DIR, "tests.cfg")))
     cfg.set("FileMan", "testdir", TEST_DIR)
     self.le = LayEd(cfg)
     self.gsr = GsRest(cfg)
     self.config = cfg
     self.workdir = os.path.abspath(
         os.path.join(TEST_DIR, "workdir", "data"))
예제 #2
0
    def test_cloneStyle(self):
        
        self.le.cloneStyle(fromStyleUrl="http://erra.ccss.cz/geoserver/rest/styles/polygon.json", toWorkspace="pprd", toStyle="MyNewPoly")

        gsr = GsRest(self.config)
        (head, cont) = gsr.getStyleSld(workspace="pprd", styleName="MyNewPoly")
        print " *** TEST *** clone style 1 ***"
        print head
        print cont

        self.le.cloneStyle(fromWorkspace="pprd", fromStyle="MyNewPoly", toWorkspace=None, toStyle="YourNewPoly")

        (head, cont) = gsr.getStyleSld(workspace=None, styleName="YourNewPoly")
        print " *** TEST *** clone style 2 ***"
        print head
        print cont
예제 #3
0
파일: layedtest.py 프로젝트: CCSS-CZ/layman
 def setUp(self):
     cfg = ConfigParser.SafeConfigParser()
     cfg.read((os.path.join(TEST_DIR,"tests.cfg")))
     cfg.set("FileMan","testdir",TEST_DIR)
     self.le = LayEd(cfg)
     self.gsr = GsRest(cfg)
     self.config = cfg
     self.workdir = os.path.abspath(os.path.join(TEST_DIR,"workdir","data"))
예제 #4
0
파일: layedtest.py 프로젝트: CCSS-CZ/layman
class LayEdTestCase(unittest.TestCase):
    """Test of the auth module"""

    le = None # LayEd
    workdir = None
    cfg = None

    def setUp(self):
        cfg = ConfigParser.SafeConfigParser()
        cfg.read((os.path.join(TEST_DIR,"tests.cfg")))
        cfg.set("FileMan","testdir",TEST_DIR)
        self.le = LayEd(cfg)
        self.gsr = GsRest(cfg)
        self.config = cfg
        self.workdir = os.path.abspath(os.path.join(TEST_DIR,"workdir","data"))

    # TODO: add tests for POST /layed?myLayer

    def test_01_publish(self):

#        ff = "world_cities_point.shp" # file
#        ll = "world_cities_point" # layer
#        st = "world_cities_point" # style
#        ff = "pest.shp" # file
#        ll = "pest" # layer
#        st = "pest" # style
        ff = "line_crs.shp" # file
        ll = "line_crs" # layer
        st = "line_crs" # style
        ws = "mis" # workspace
        ds = "testschema" # datastore
        sch = "testschema" # schema        

        # Check #

        # Check if the layer is not already there
        (head, cont) = self.gsr.getLayer(ws, ll)
        self.assertNotEquals("200", head["status"], "The layer already exists. Please, remove it manually." )

        # Check if the style is not already there
        (head, cont) = self.gsr.getStyle(ws, st)
        self.assertNotEquals("200", head["status"], "The style already exists. Please, remove it manually." )

        # Publish #

        self.le.publish(fsUserDir=self.workdir, fsGroupDir="", dbSchema=ds, gsWorkspace=ws, fileName=ff)

        # Test #

        # Check if the layer is there
        (head, cont) = self.gsr.getLayer(ws, ll)
        self.assertEquals("200", head["status"], "The layer is not there. Was it created under another name?")

        # Check the style of the layer
        layerJson = json.loads(cont)
        styleName = layerJson["layer"]["defaultStyle"]["name"]
        self.assertEquals(st, styleName, "The layer is there, but it has wrong style assinged.")

        # Check if the style is there
        (head, cont) = self.gsr.getStyle(ws, st)
        self.assertEquals("200", head["status"], "The style is not there." )
예제 #5
0
class LayEdTestCase(unittest.TestCase):
    """Test of the auth module"""

    le = None  # LayEd
    workdir = None
    cfg = None

    def setUp(self):
        cfg = ConfigParser.SafeConfigParser()
        cfg.read((os.path.join(TEST_DIR, "tests.cfg")))
        cfg.set("FileMan", "testdir", TEST_DIR)
        self.le = LayEd(cfg)
        self.gsr = GsRest(cfg)
        self.config = cfg
        self.workdir = os.path.abspath(
            os.path.join(TEST_DIR, "workdir", "data"))

    # TODO: add tests for POST /layed?myLayer

    def test_01_publish(self):

        #        ff = "world_cities_point.shp" # file
        #        ll = "world_cities_point" # layer
        #        st = "world_cities_point" # style
        #        ff = "pest.shp" # file
        #        ll = "pest" # layer
        #        st = "pest" # style
        ff = "line_crs.shp"  # file
        ll = "line_crs"  # layer
        st = "line_crs"  # style
        ws = "mis"  # workspace
        ds = "testschema"  # datastore
        sch = "testschema"  # schema

        # Check #

        # Check if the layer is not already there
        (head, cont) = self.gsr.getLayer(ws, ll)
        self.assertNotEquals(
            "200", head["status"],
            "The layer already exists. Please, remove it manually.")

        # Check if the style is not already there
        (head, cont) = self.gsr.getStyle(ws, st)
        self.assertNotEquals(
            "200", head["status"],
            "The style already exists. Please, remove it manually.")

        # Publish #

        self.le.publish(fsUserDir=self.workdir,
                        fsGroupDir="",
                        dbSchema=ds,
                        gsWorkspace=ws,
                        fileName=ff)

        # Test #

        # Check if the layer is there
        (head, cont) = self.gsr.getLayer(ws, ll)
        self.assertEquals(
            "200", head["status"],
            "The layer is not there. Was it created under another name?")

        # Check the style of the layer
        layerJson = json.loads(cont)
        styleName = layerJson["layer"]["defaultStyle"]["name"]
        self.assertEquals(
            st, styleName,
            "The layer is there, but it has wrong style assinged.")

        # Check if the style is there
        (head, cont) = self.gsr.getStyle(ws, st)
        self.assertEquals("200", head["status"], "The style is not there.")