当前位置: 首页>>代码示例>>Python>>正文


Python fulltextsearch.FullTextSearchView类代码示例

本文整理汇总了Python中c2cgeoportal.views.fulltextsearch.FullTextSearchView的典型用法代码示例。如果您正苦于以下问题:Python FullTextSearchView类的具体用法?Python FullTextSearchView怎么用?Python FullTextSearchView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FullTextSearchView类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_badrequest_noquery

    def test_badrequest_noquery(self):
        from pyramid.httpexceptions import HTTPBadRequest
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request()
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, HTTPBadRequest))
开发者ID:CDTRH,项目名称:c2cgeoportal,代码行数:8,代码来源:test_fulltextsearch.py

示例2: test_nomatch

    def test_nomatch(self):
        from geojson.feature import FeatureCollection
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(params=dict(query='foo'))
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, FeatureCollection))
        self.assertEqual(len(response.features), 0)
开发者ID:CDTRH,项目名称:c2cgeoportal,代码行数:9,代码来源:test_fulltextsearch.py

示例3: test_unknown_laguage

    def test_unknown_laguage(self):
        from pyramid.httpexceptions import HTTPInternalServerError
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request()
        request.registry.settings['default_locale_name'] = 'it'
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, HTTPInternalServerError))
开发者ID:CDTRH,项目名称:c2cgeoportal,代码行数:9,代码来源:test_fulltextsearch.py

示例4: test_badrequest_partitionlimit

    def test_badrequest_partitionlimit(self):
        from pyramid.httpexceptions import HTTPBadRequest
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(
            params=dict(query='text', partitionlimit='bad')
        )
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, HTTPBadRequest))
开发者ID:CDTRH,项目名称:c2cgeoportal,代码行数:10,代码来源:test_fulltextsearch.py

示例5: test_interface

    def test_interface(self):
        from geojson.feature import FeatureCollection
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(
            params=dict(query="params", limit=10, interface="main")
        )
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, FeatureCollection))
        self.assertEqual({feature.properties["label"] for feature in response.features}, set(["label5", "label6"]))
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:11,代码来源:test_fulltextsearch.py

示例6: test_unknown_laguage

    def test_unknown_laguage(self):
        from pyramid.httpexceptions import HTTPInternalServerError
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView
        from webob.acceptparse import Accept

        request = self._create_dummy_request()
        request.registry.settings["default_locale_name"] = "it"
        request.accept_language = Accept("es")
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, HTTPInternalServerError))
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:11,代码来源:test_fulltextsearch.py

示例7: test_private_with_role_nomatch

    def test_private_with_role_nomatch(self):
        from geojson.feature import FeatureCollection
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(
            params=dict(query='ven nei', limit=40),
            username=u'__test_user1'
        )
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, FeatureCollection))
        self.assertEqual(len(response.features), 0)
开发者ID:CDTRH,项目名称:c2cgeoportal,代码行数:12,代码来源:test_fulltextsearch.py

示例8: test_params

    def test_params(self):
        from geojson.feature import FeatureCollection
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(
            params=dict(query='params', limit=10)
        )
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, FeatureCollection))
        self.assertEqual(len(response.features), 1)
        self.assertEqual(response.features[0].properties['label'], 'label5')
        self.assertEqual(response.features[0].properties['params'], {'floor': 5})
开发者ID:CDTRH,项目名称:c2cgeoportal,代码行数:13,代码来源:test_fulltextsearch.py

示例9: test_match_partitionlimit

    def test_match_partitionlimit(self):
        from geojson.feature import FeatureCollection
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(
            params=dict(query='tra sol', limit=40, partitionlimit=1)
        )
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, FeatureCollection))
        self.assertEqual(len(response.features), 1)
        self.assertEqual(response.features[0].properties['label'], 'label1')
        self.assertEqual(response.features[0].properties['layer_name'], 'layer1')
开发者ID:CDTRH,项目名称:c2cgeoportal,代码行数:13,代码来源:test_fulltextsearch.py

示例10: test_params_actions

    def test_params_actions(self):
        from geojson.feature import FeatureCollection
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(
            params=dict(query="params", limit=10)
        )
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, FeatureCollection))
        self.assertEqual(len(response.features), 1)
        self.assertEqual(response.features[0].properties["label"], "label5")
        self.assertEqual(response.features[0].properties["params"], {"floor": 5})
        self.assertEqual(response.features[0].properties["actions"], [{"action": "add_layer", "data": "layer1"}])
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:14,代码来源:test_fulltextsearch.py

示例11: test_private_with_role_match

    def test_private_with_role_match(self):
        from geojson.feature import FeatureCollection
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(
            params=dict(query="ven nei", limit=40),
            username=u"__test_user2"
        )
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, FeatureCollection))
        self.assertEqual(len(response.features), 1)
        self.assertEqual(response.features[0].properties["label"], "label3")
        self.assertEqual(response.features[0].properties["layer_name"], "layer3")
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:14,代码来源:test_fulltextsearch.py

示例12: test_match

    def test_match(self):
        from geojson.feature import FeatureCollection
        from c2cgeoportal.views.fulltextsearch import FullTextSearchView

        request = self._create_dummy_request(
            params=dict(query="tra sol", limit=40)
        )
        fts = FullTextSearchView(request)
        response = fts.fulltextsearch()
        self.assertTrue(isinstance(response, FeatureCollection))
        self.assertEqual(len(response.features), 2)
        self.assertEqual(response.features[0].properties["label"], "label1")
        self.assertEqual(response.features[0].properties["layer_name"], "layer1")
        self.assertEqual(response.features[1].properties["label"], "label4")
        self.assertEqual(response.features[1].properties["layer_name"], "layer1")
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:15,代码来源:test_fulltextsearch.py


注:本文中的c2cgeoportal.views.fulltextsearch.FullTextSearchView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。