Skip to content
Snippets Groups Projects
Commit afd8a876c64c authored by Samuel Trégouët's avatar Samuel Trégouët
Browse files

test: fulltext_indexable_rql

parent 6527f18a1a69
No related branches found
No related tags found
No related merge requests found
from yams.buildobjs import (EntityType, String, Int,
SubjectRelation, RelationDefinition)
class Person(EntityType):
name = String()
age = Int()
......@@ -13,7 +13,8 @@
from cubicweb.devtools import testlib
from cubicweb.cwconfig import CubicWebConfiguration
from cubes.elasticsearch import ccplugin
from cubes.elasticsearch.es import indexable_types, INDEX_SETTINGS
from cubes.elasticsearch.es import (indexable_types, INDEX_SETTINGS,
fulltext_indexable_rql)
# TODO - find a way to configure ElasticSearch as non threaded while running tests
# so that the traces show the full stack, not just starting from connection.http_*
......@@ -157,7 +158,7 @@
with self.new_access('anon').web_request() as req:
# self._cw.form.get('search'))
self.view('esearch', req=req, template=None)
@patch('elasticsearch_dsl.search.Search.execute', new=mock_execute_150)
@patch('elasticsearch_dsl.connections.connections.get_connection', new=mock_cnx)
def skip_test_search_view_150(self):
......@@ -166,5 +167,17 @@
self.view('esearch', req=req, template=None)
class ElasticsearchTC(testlib.CubicWebTC):
def test_1(self):
with self.admin_access.cnx() as cnx:
print (cnx.vreg.schema)
schema = cnx.vreg.schema
etype = 'Person'
rql = fulltext_indexable_rql(etype, schema)
self.assertIn('age', rql)
self.assertNotIn('eid', rql)
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment