Beispiel #1
0
    def setUp(self):  # noqa
        # 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, LayerInternalWMS, LayerExternalWMS, LayerWMTS, \
            UIMetadata, WMTSDimension

        main = Interface(name=u"main")
        mobile = Interface(name=u"mobile")
        min_levels = Interface(name=u"min_levels")

        layer_v1 = LayerV1(name=u"__test_layer_v1", public=True)
        layer_v1.interfaces = [main]
        layer_v1.ui_metadata = [UIMetadata("test", "v1")]
        layer_internal_wms = LayerInternalWMS(name=u"__test_layer_internal_wms", public=True)
        layer_internal_wms.layer = "__test_layer_internal_wms"
        layer_internal_wms.interfaces = [main, min_levels]
        layer_internal_wms.ui_metadata = [UIMetadata("test", "internal_wms")]
        layer_external_wms = LayerExternalWMS(name=u"__test_layer_external_wms", public=True)
        layer_external_wms.interfaces = [main]
        layer_external_wms.ui_metadata = [UIMetadata("test", "external_wms")]
        layer_wmts = LayerWMTS(name=u"__test_layer_wmts", public=True)
        layer_wmts.interfaces = [main, mobile]
        layer_wmts.ui_metadata = [UIMetadata("test", "wmts")]
        layer_wmts.dimensions = [WMTSDimension("year", "2015")]

        layer_group_1 = LayerGroup(name=u"__test_layer_group_1")
        layer_group_1.children = [layer_v1, layer_internal_wms, layer_external_wms, layer_wmts]
        layer_group_1.ui_metadata = [UIMetadata("test", "group_1")]

        layer_group_2 = LayerGroup(name=u"__test_layer_group_2")
        layer_group_2.children = [layer_wmts, layer_internal_wms, layer_external_wms]

        layer_group_3 = LayerGroup(name=u"__test_layer_group_3")
        layer_group_3.children = [layer_wmts, layer_internal_wms, layer_external_wms]

        layer_group_4 = LayerGroup(name=u"__test_layer_group_4")
        layer_group_4.children = [layer_group_2]

        theme = Theme(name=u"__test_theme")
        theme.interfaces = [main, mobile]
        theme.ui_metadata = [UIMetadata("test", "theme")]
        theme.children = [
            layer_group_1, layer_group_2
        ]
        theme_layer = Theme(name=u"__test_theme_layer")
        theme_layer.interfaces = [min_levels]
        theme_layer.children = [
            layer_internal_wms
        ]

        functionality1 = Functionality(name=u"test_name", value=u"test_value_1")
        functionality2 = Functionality(name=u"test_name", value=u"test_value_2")
        theme.functionalities = [functionality1, functionality2]

        DBSession.add_all([theme, theme_layer])

        transaction.commit()
Beispiel #2
0
    def setUp(self):  # noqa
        # 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, LayerInternalWMS, LayerExternalWMS, LayerWMTS, \
            UIMetadata, WMTSDimension

        main = Interface(name=u'main')
        mobile = Interface(name=u'mobile')
        min_levels = Interface(name=u'min_levels')

        layer_v1 = LayerV1(name=u'__test_layer_v1', public=True)
        layer_v1.interfaces = [main]
        layer_v1.ui_metadata = [UIMetadata('test', 'v1')]
        layer_internal_wms = LayerInternalWMS(name=u'__test_layer_internal_wms', public=True)
        layer_internal_wms.layer = "__test_layer_internal_wms"
        layer_internal_wms.interfaces = [main, min_levels]
        layer_internal_wms.ui_metadata = [UIMetadata('test', 'internal_wms')]
        layer_external_wms = LayerExternalWMS(name=u'__test_layer_external_wms', public=True)
        layer_external_wms.interfaces = [main]
        layer_external_wms.ui_metadata = [UIMetadata('test', 'external_wms')]
        layer_wmts = LayerWMTS(name=u'__test_layer_wmts', public=True)
        layer_wmts.interfaces = [main, mobile]
        layer_wmts.ui_metadata = [UIMetadata('test', 'wmts')]
        layer_wmts.dimensions = [WMTSDimension('year', '2015')]

        layer_group_1 = LayerGroup(name=u'__test_layer_group_1')
        layer_group_1.children = [layer_v1, layer_internal_wms, layer_external_wms, layer_wmts]
        layer_group_1.ui_metadata = [UIMetadata('test', 'group_1')]

        layer_group_2 = LayerGroup(name=u'__test_layer_group_2')
        layer_group_2.children = [layer_wmts, layer_internal_wms, layer_external_wms]

        layer_group_3 = LayerGroup(name=u'__test_layer_group_3')
        layer_group_3.children = [layer_wmts, layer_internal_wms, layer_external_wms]

        layer_group_4 = LayerGroup(name=u'__test_layer_group_4')
        layer_group_4.children = [layer_group_2]

        theme = Theme(name=u'__test_theme')
        theme.interfaces = [main, mobile]
        theme.ui_metadata = [UIMetadata('test', 'theme')]
        theme.children = [
            layer_group_1, layer_group_2
        ]
        theme_layer = Theme(name=u'__test_theme_layer')
        theme_layer.interfaces = [min_levels]
        theme_layer.children = [
            layer_internal_wms
        ]

        functionality1 = Functionality(name=u'test_name', value=u'test_value_1')
        functionality2 = Functionality(name=u'test_name', value=u'test_value_2')
        theme.functionalities = [functionality1, functionality2]

        DBSession.add_all([theme, theme_layer])

        transaction.commit()