def test_theme(self): from c2cgeoportal.models import DBSession, Theme from c2cgeoportal.views.entry import Entry, cache_region request = testing.DummyRequest() request.headers['Host'] = host request.static_url = lambda url: 'http://example.com/dummy/static/url' request.route_url = lambda url: mapserv_url curdir = os.path.dirname(os.path.abspath(__file__)) mapfile = os.path.join(curdir, 'c2cgeoportal_test.map') ms_url = "%s?map=%s&" % (mapserv_url, mapfile) request.registry.settings = { 'mapserv_url': ms_url, } request.user = None entry = Entry(request) cache_region.invalidate() themes = entry.themes() self.assertEquals(len(themes), 0) cache_region.invalidate() themes, errors = entry._themes(None) self.assertEquals(len(errors), 11) self.assertEquals(errors[0], 'Too many recursions with group "__test_layer_group"')
def test_theme(self): from c2cgeoportal.views.entry import Entry, cache_region request = testing.DummyRequest() request.headers['Host'] = host request.static_url = lambda url: 'http://example.com/dummy/static/url' request.route_url = lambda url: mapserv_url curdir = os.path.dirname(os.path.abspath(__file__)) mapfile = os.path.join(curdir, 'c2cgeoportal_test.map') ms_url = "%s?map=%s&" % (mapserv_url, mapfile) request.registry.settings['mapserv_url'] = ms_url request.user = None entry = Entry(request) cache_region.invalidate() themes = entry.themes() self.assertEquals(len(themes), 0) cache_region.invalidate() themes, errors = entry._themes(None) self.assertEquals(len(errors), 22) self.assertEquals( errors[0], 'The layer __test_layer is not defined in WMS capabilities') self.assertEquals( errors[11], 'Too many recursions with group "__test_layer_group"')
def test_theme(self): from c2cgeoportal.views.entry import Entry, cache_region request = testing.DummyRequest() request.static_url = lambda url: "http://example.com/dummy/static/url" request.route_url = lambda url: mapserv_url request.client_addr = None request.user = None entry = Entry(request) cache_region.invalidate() themes = entry.themes() self.assertEquals([t["name"] for t in themes], [u"__test_theme"]) cache_region.invalidate() themes, errors = entry._themes(None, u"desktop") self.assertEquals(len([e for e in errors if e == "Too many recursions with group '__test_layer_group'"]), 1)
def test_theme(self): from c2cgeoportal.views.entry import Entry, cache_region request = testing.DummyRequest() request.headers["Host"] = host request.static_url = lambda url: "http://example.com/dummy/static/url" request.route_url = lambda url: mapserv_url request.client_addr = None curdir = os.path.dirname(os.path.abspath(__file__)) mapfile = os.path.join(curdir, "c2cgeoportal_test.map") ms_url = "%s?map=%s&" % (mapserv_url, mapfile) request.registry.settings["mapserverproxy"]["mapserv_url"] = ms_url request.user = None entry = Entry(request) cache_region.invalidate() themes = entry.themes() self.assertEquals([t["name"] for t in themes], [u"__test_theme"]) cache_region.invalidate() themes, errors = entry._themes(None, u"main") self.assertEquals(len([e for e in errors if e == "Too many recursions with group '__test_layer_group'"]), 1)
def test_theme(self): from c2cgeoportal.views.entry import Entry, cache_region request = testing.DummyRequest() request.headers["Host"] = host request.static_url = lambda url: "http://example.com/dummy/static/url" request.route_url = lambda url: mapserv_url request.client_addr = None request.user = None entry = Entry(request) cache_region.invalidate() themes = entry.themes() self.assertEquals([t["name"] for t in themes], [u"__test_theme"]) cache_region.invalidate() themes, errors = entry._themes(None, u"desktop") self.assertEquals( len([ e for e in errors if e == "Too many recursions with group '__test_layer_group'" ]), 1)
def test_theme(self): from c2cgeoportal.views.entry import Entry, cache_region request = testing.DummyRequest() request.headers["Host"] = host request.static_url = lambda url: "http://example.com/dummy/static/url" request.route_url = lambda url: mapserv_url curdir = os.path.dirname(os.path.abspath(__file__)) mapfile = os.path.join(curdir, "c2cgeoportal_test.map") ms_url = "%s?map=%s&" % (mapserv_url, mapfile) request.registry.settings["mapserv_url"] = ms_url request.user = None entry = Entry(request) cache_region.invalidate() themes = entry.themes() self.assertEquals(len(themes), 0) cache_region.invalidate() themes, errors = entry._themes(None) self.assertEquals(len(errors), 22) self.assertEquals(errors[0], "The layer __test_layer is not defined in WMS capabilities") self.assertEquals(errors[11], 'Too many recursions with group "__test_layer_group"')