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"))
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
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"))
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." )
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.")