本文整理汇总了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))
示例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)
示例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))
示例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))
示例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"]))
示例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))
示例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)
示例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})
示例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')
示例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"}])
示例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")
示例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")