def setup_method(self, _): # Always see the diff # https://docs.python.org/2/library/unittest.html#unittest.TestCase.maxDiff self.maxDiff = None from c2cgeoportal.models import DBSession, \ Theme, LayerGroup, Interface, LayerWMS, LayerWMTS, Dimension ogc_server, _ = create_default_ogcserver() main = Interface(name="main") layer_wms_1 = LayerWMS(name="__test_layer_wms_1", public=True) layer_wms_1.layer = "__test_layer_wms_1" layer_wms_1.interfaces = [main] layer_wms_1.ogc_server = ogc_server Dimension("A", "a", layer_wms_1) layer_wms_2 = LayerWMS(name="__test_layer_wms_2", public=True) layer_wms_2.layer = "__test_layer_wms_2" layer_wms_2.interfaces = [main] layer_wms_2.ogc_server = ogc_server Dimension("A", "b", layer_wms_2) layer_wms_3 = LayerWMS(name="__test_layer_wms_3", public=True) layer_wms_3.layer = "__test_layer_wms_3" layer_wms_3.interfaces = [main] layer_wms_3.ogc_server = ogc_server Dimension("A", None, layer_wms_3) layer_wms_4 = LayerWMS(name="__test_layer_wms_4", public=True) layer_wms_4.layer = "__test_layer_wms_4" layer_wms_4.interfaces = [main] layer_wms_4.ogc_server = ogc_server Dimension("A", "a", layer_wms_4) layer_wms_5 = LayerWMS(name="__test_layer_wms_5", public=True) layer_wms_5.layer = "__test_layer_wms_5" layer_wms_5.interfaces = [main] layer_wms_5.ogc_server = ogc_server Dimension("B", "b", layer_wms_5) layer_wms_6 = LayerWMS(name="__test_layer_wms_6", public=True) layer_wms_6.layer = "__test_layer_wms_6" layer_wms_6.interfaces = [main] layer_wms_6.ogc_server = ogc_server Dimension("FILTER", "countries:\"name\" IN ( 'Germany' , 'Italy' )", layer_wms_6) layer_wmts = LayerWMTS(name="__test_layer_wmts", public=True) layer_wmts.url = "http://example.com/1.0.0/WMTSCapabilities.xml" layer_wmts.layer = "map" layer_wmts.interfaces = [main] Dimension("B", "b", layer_wmts) layer_wmts_2 = LayerWMTS(name="__test_layer_wmts_2", public=True) layer_wmts_2.url = "http://example.com/1.0.0/WMTSCapabilities.xml" layer_wmts_2.layer = "map" layer_wmts_2.interfaces = [main] Dimension("FILTER", "countries:\"name\" IN ( 'Germany' , 'Italy' )", layer_wmts_2) layer_group_1 = LayerGroup(name="__test_layer_group_1") layer_group_1.children = [layer_wms_1, layer_wmts, layer_wmts_2] layer_group_2 = LayerGroup(name="__test_layer_group_2") layer_group_2.children = [layer_wms_1, layer_wms_2] layer_group_3 = LayerGroup(name="__test_layer_group_3") layer_group_3.children = [layer_wms_1, layer_wms_3] layer_group_4 = LayerGroup(name="__test_layer_group_4") layer_group_4.children = [layer_wms_1, layer_wms_4] layer_group_5 = LayerGroup(name="__test_layer_group_5") layer_group_5.children = [layer_wms_1, layer_wms_5, layer_wms_6] layer_group_6 = LayerGroup(name="__test_layer_group_6") layer_group_6.children = [layer_wms_3] theme = Theme(name="__test_theme") theme.interfaces = [main] theme.children = [ layer_group_1, layer_group_2, layer_group_3, layer_group_4, layer_group_5, layer_group_6, ] DBSession.add(theme) transaction.commit()
def setup_method(self, _): # Always see the diff # https://docs.python.org/2/library/unittest.html#unittest.TestCase.maxDiff self.maxDiff = None from c2cgeoportal.models import DBSession, \ Theme, LayerGroup, Interface, LayerWMS, LayerWMTS PointTest.__table__.create(bind=DBSession.bind, checkfirst=True) main = Interface(name="desktop") ogc_server, _ = create_default_ogcserver() layer_wms_1 = LayerWMS(name="__test_layer_time_1", public=True) layer_wms_1.layer = "test_wmstime" layer_wms_1.time_mode = "value" layer_wms_1.interfaces = [main] layer_wms_1.ogc_server = ogc_server layer_wms_2 = LayerWMS(name="__test_layer_time_2", public=True) layer_wms_2.layer = "test_wmstime2" layer_wms_2.time_mode = "value" layer_wms_2.interfaces = [main] layer_wms_2.ogc_server = ogc_server layer_wmts = LayerWMTS(name="__test_layer_wmts", public=True) layer_wmts.url = "http://example.com/1.0.0/WMTSCapabilities.xml" layer_wmts.layer = "map" layer_wmts.interfaces = [main] layer_wms_group = LayerWMS(name="__test_layer_time_group", public=True) layer_wms_group.layer = "test_wmstimegroup" layer_wms_group.time_mode = "range" layer_wms_group.time_widget = "datepicker" layer_wms_group.interfaces = [main] layer_wms_group.ogc_server = ogc_server layer_group_1 = LayerGroup(name="__test_layer_group_1") layer_group_1.children = [layer_wms_1, layer_wms_2] layer_group_2 = LayerGroup(name="__test_layer_group_2") layer_group_2.children = [layer_wms_1] layer_group_3 = LayerGroup(name="__test_layer_group_3") layer_group_3.children = [layer_wms_1, layer_wms_2, layer_wms_group] layer_group_4 = LayerGroup(name="__test_layer_group_4") layer_group_4.children = [layer_wms_group] layer_group_5 = LayerGroup(name="__test_layer_group_5") layer_group_5.children = [layer_wms_1, layer_wms_2] layer_group_6 = LayerGroup(name="__test_layer_group_6") layer_group_6.children = [layer_wms_1, layer_wms_2, layer_wmts] layer_group_7 = LayerGroup(name="__test_layer_group_7") layer_group_7.children = [layer_wms_1] theme = Theme(name="__test_theme") theme.interfaces = [main] theme.children = [ layer_group_1, layer_group_2, layer_group_3, layer_group_4, layer_group_5, layer_group_6, layer_group_7, ] DBSession.add_all([theme]) transaction.commit()
def setup_method(self, _): # Always see the diff # https://docs.python.org/2/library/unittest.html#unittest.TestCase.maxDiff self.maxDiff = None from c2cgeoportal.models import DBSession, \ Theme, LayerGroup, Functionality, Interface, \ LayerV1, OGCServer, LayerWMS, LayerWMTS, \ Metadata, Dimension, OGCSERVER_AUTH_NOAUTH main = Interface(name="desktop") mobile = Interface(name="mobile") min_levels = Interface(name="min_levels") layer_v1 = LayerV1(name="__test_layer_v1", public=True) layer_v1.interfaces = [main] layer_v1.metadatas = [Metadata("test", "v1")] ogc_server_internal, _ = create_default_ogcserver() ogc_server_external = OGCServer(name="__test_ogc_server_chtopo", url="http://wms.geo.admin.ch/", image_type="image/jpeg", auth=OGCSERVER_AUTH_NOAUTH) ogc_server_external.wfs_support = False layer_internal_wms = LayerWMS(name="__test_layer_internal_wms", public=True) layer_internal_wms.layer = "__test_layer_internal_wms" layer_internal_wms.interfaces = [main, min_levels] layer_internal_wms.metadatas = [Metadata("test", "internal_wms")] layer_internal_wms.ogc_server = ogc_server_internal layer_external_wms = LayerWMS(name="__test_layer_external_wms", layer="ch.swisstopo.dreiecksvermaschung", public=True) layer_external_wms.interfaces = [main] layer_external_wms.metadatas = [Metadata("test", "external_wms")] layer_external_wms.ogc_server = ogc_server_external layer_wmts = LayerWMTS(name="__test_layer_wmts", public=True) layer_wmts.url = "http://example.com/1.0.0/WMTSCapabilities.xml" layer_wmts.layer = "map" layer_wmts.interfaces = [main, mobile] layer_wmts.metadatas = [Metadata("test", "wmts")] layer_wmts.dimensions = [Dimension("year", "2015")] layer_group_1 = LayerGroup(name="__test_layer_group_1") layer_group_1.children = [ layer_v1, layer_internal_wms, layer_external_wms, layer_wmts ] layer_group_1.metadatas = [Metadata("test", "group_1")] layer_group_2 = LayerGroup(name="__test_layer_group_2") layer_group_2.children = [ layer_wmts, layer_internal_wms, layer_external_wms ] layer_group_3 = LayerGroup(name="__test_layer_group_3") layer_group_3.children = [ layer_wmts, layer_internal_wms, layer_external_wms ] layer_group_4 = LayerGroup(name="__test_layer_group_4") layer_group_4.children = [layer_group_2] theme = Theme(name="__test_theme") theme.interfaces = [main, mobile] theme.metadatas = [Metadata("test", "theme")] theme.children = [layer_group_1, layer_group_2] theme_layer = Theme(name="__test_theme_layer") theme_layer.interfaces = [min_levels] theme_layer.children = [layer_internal_wms] functionality1 = Functionality(name="test_name", value="test_value_1") functionality2 = Functionality(name="test_name", value="test_value_2") theme.functionalities = [functionality1, functionality2] DBSession.add_all([theme, theme_layer]) transaction.commit()
def setup_method(self, _): # Always see the diff # https://docs.python.org/2/library/unittest.html#unittest.TestCase.maxDiff self.maxDiff = None from c2cgeoportal.models import DBSession, \ Theme, LayerGroup, Interface, OGCServer, LayerWMS, LayerWMTS main = Interface(name="main") ogc_server_internal, _ = create_default_ogcserver() ogc_server_external = OGCServer(name="__test_ogc_server_external", url="http://wms.geo.admin.ch/", image_type="image/jpeg") layer_internal_wms = LayerWMS(name="__test_layer_internal_wms", public=True) layer_internal_wms.layer = "__test_layer_internal_wms" layer_internal_wms.interfaces = [main] layer_internal_wms.ogc_server = ogc_server_internal layer_external_wms = LayerWMS(name="__test_layer_external_wms", layer="ch.swisstopo.dreiecksvermaschung", public=True) layer_external_wms.interfaces = [main] layer_external_wms.ogc_server = ogc_server_external layer_wmts = LayerWMTS(name="__test_layer_wmts", public=True) layer_wmts.url = "http://example.com/1.0.0/WMTSCapabilities.xml" layer_wmts.layer = "map" layer_wmts.interfaces = [main] layer_group_1 = LayerGroup(name="__test_layer_group_1") layer_group_1.children = [layer_internal_wms] layer_group_2 = LayerGroup(name="__test_layer_group_2") layer_group_2.children = [layer_external_wms] layer_group_3 = LayerGroup(name="__test_layer_group_3") layer_group_3.children = [layer_wmts] layer_group_4 = LayerGroup(name="__test_layer_group_4") layer_group_4.children = [layer_group_1, layer_group_2] layer_group_5 = LayerGroup(name="__test_layer_group_5") layer_group_5.children = [layer_group_1, layer_group_3] layer_group_6 = LayerGroup(name="__test_layer_group_6") layer_group_6.children = [layer_internal_wms] layer_group_7 = LayerGroup(name="__test_layer_group_7") layer_group_7.children = [layer_group_1, layer_group_6] layer_group_8 = LayerGroup(name="__test_layer_group_8") layer_group_8.children = [layer_group_2, layer_group_6] theme = Theme(name="__test_theme") theme.interfaces = [main] theme.children = [ layer_group_1, layer_group_2, layer_group_3, layer_group_4, layer_group_5, layer_group_7, layer_group_8, ] DBSession.add(theme) transaction.commit()