Ejemplo n.º 1
0
    def test_WFS_types(self):
        from c2cgeoportal.models import DBSession, User
        from c2cgeoportal.views.entry import Entry
        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,
            'external_mapserv_url': ms_url,
            'functionalities': {
                'available_in_templates': []
            }
        }
        entry = Entry(request)
        request.user = None

        response = entry._getVars()
        self.assertEquals(response['serverError'], '[]')

        result = '["testpoint_unprotected", "testpoint_protected", "testpoint_protected_query_with_collect", "testpoint_substitution", "testpoint_column_restriction", "test_wmsfeatures"]'
        self.assertEquals(response['WFSTypes'], result)
        self.assertEquals(response['externalWFSTypes'], result)
Ejemplo n.º 2
0
    def test_WFS_types(self):
        from c2cgeoportal.models import DBSession, User
        from c2cgeoportal.views.entry import Entry
        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,
            'external_mapserv_url': ms_url,
            'functionalities': {
                'available_in_templates': []
            }
        }
        entry = Entry(request)
        request.user = None

        response = entry._getVars()
        self.assertEquals(response['serverError'], '[]')

        result = '["testpoint_unprotected", "testpoint_protected", "testpoint_protected_query_with_collect", "testpoint_substitution", "testpoint_column_restriction", "test_wmsfeatures"]'
        self.assertEquals(response['WFSTypes'], result)
        self.assertEquals(response['externalWFSTypes'], result)
Ejemplo n.º 3
0
    def test_permalink_themes(self):
        from c2cgeoportal.views.entry import Entry
        request = self._create_request_obj()
        request.registry.settings['external_mapserv_url'] = \
            request.registry.settings['mapserv_url']
        #request.static_url = lambda url: 'http://example.com/dummy/static/url'
        request.params = {
            'permalink_themes': 'my_themes',
        }
        entry = Entry(request)

        response = entry._getVars()
        self.assertEquals(response['permalink_themes'], '["my_themes"]')
Ejemplo n.º 4
0
    def test_permalink_themes(self):
        from c2cgeoportal.views.entry import Entry
        request = self._create_request_obj()
        request.registry.settings['external_mapserv_url'] = \
            request.registry.settings['mapserv_url']
        #request.static_url = lambda url: 'http://example.com/dummy/static/url'
        request.params = {
            'permalink_themes': 'my_themes',
        }
        entry = Entry(request)

        response = entry._getVars()
        self.assertEquals(response['permalink_themes'], '["my_themes"]')
Ejemplo n.º 5
0
    def test_permalink_themes(self):
        from c2cgeoportal.views.entry import Entry

        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.registry.settings = {"mapserv_url": mapserv_url, "external_mapserv_url": mapserv_url}
        request.params = {"permalink_themes": "my_themes"}
        entry = Entry(request)
        request.user = None

        response = entry._getVars()
        self.assertEquals(response["permalink_themes"], '["my_themes"]')
Ejemplo n.º 6
0
    def test_permalink_themes(self):
        from c2cgeoportal.views.entry import Entry
        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.registry.settings = {
            'mapserv_url': mapserv_url,
            'external_mapserv_url': mapserv_url,
        }
        request.params = {
            'permalink_themes': 'my_themes',
        }
        entry = Entry(request)
        request.user = None

        response = entry._getVars()
        self.assertEquals(response['permalink_themes'], '["my_themes"]')
Ejemplo n.º 7
0
    def test_permalink_themes(self):
        from c2cgeoportal.views.entry import Entry
        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.registry.settings = {
            'mapserv_url': mapserv_url,
            'external_mapserv_url': mapserv_url,
        }
        request.params = {
            'permalink_themes': 'my_themes',
        }
        entry = Entry(request)
        request.user = None

        response = entry._getVars()
        self.assertEquals(response['permalink_themes'], '["my_themes"]')
Ejemplo n.º 8
0
    def test_WFS_types(self):
        from c2cgeoportal.views.entry import Entry

        request = self._create_request_obj()
        #request.static_url = lambda url: 'http://example.com/dummy/static/url'
        request.registry.settings.update({
            'external_mapserv_url': request.registry.settings['mapserv_url'],
        })
        entry = Entry(request)

        response = entry._getVars()
        self.assertEquals(
            response['serverError'],
            '["The layer __test_public_layer is not defined in WMS capabilities", '
            '"The layer __test_layer_in_group is not defined in WMS capabilities"]'
        )

        result = '["testpoint_unprotected", "testpoint_protected", ' \
            '"testpoint_protected_query_with_collect", ' \
            '"testpoint_substitution", "testpoint_column_restriction", ' \
            '"test_wmsfeatures", "test_wmstime", "test_wmstime2"]'
        self.assertEquals(response['WFSTypes'], result)
        self.assertEquals(response['externalWFSTypes'], result)
Ejemplo n.º 9
0
    def test_WFS_types(self):
        from c2cgeoportal.views.entry import Entry

        request = self._create_request_obj()
        #request.static_url = lambda url: 'http://example.com/dummy/static/url'
        request.registry.settings.update({
            'external_mapserv_url':
            request.registry.settings['mapserv_url'],
        })
        entry = Entry(request)

        response = entry._getVars()
        self.assertEquals(
            response['serverError'],
            '["The layer __test_public_layer is not defined in WMS capabilities", '
            '"The layer __test_layer_in_group is not defined in WMS capabilities"]'
        )

        result = '["testpoint_unprotected", "testpoint_protected", ' \
            '"testpoint_protected_query_with_collect", ' \
            '"testpoint_substitution", "testpoint_column_restriction", ' \
            '"test_wmsfeatures", "test_wmstime", "test_wmstime2"]'
        self.assertEquals(response['WFSTypes'], result)
        self.assertEquals(response['externalWFSTypes'], result)