Commit 2307e068 authored by Arthur Lutz's avatar Arthur Lutz
Browse files

paint it black

parent 6683c63b10ca
......@@ -42,7 +42,10 @@ class ContentUpdateIndexES(hook.Hook):
def __call__(self):
op_type = "delete" if self.event == "after_delete_entity" else "index"
IndexEsOperation.get_instance(self._cw).add_data(
{"op_type": op_type, "entity": self.entity, }
{
"op_type": op_type,
"entity": self.entity,
}
)
......@@ -61,7 +64,10 @@ class RelationsUpdateIndexES(hook.Hook):
):
if entity_indexable(entity):
IndexEsOperation.get_instance(self._cw).add_data(
{"op_type": "index", "entity": entity, }
{
"op_type": "index",
"entity": entity,
}
)
......
......@@ -309,7 +309,12 @@ class ElasticSearchView(StartupView):
url_params["page"] = page
url = self._cw.build_url(**url_params)
if page == current_page:
ul(t.li(t.a(t.b(page), href=xml_escape(url)), Class="active",))
ul(
t.li(
t.a(t.b(page), href=xml_escape(url)),
Class="active",
)
)
else:
ul(t.li(t.a(page, href=xml_escape(url))))
return url
......
......@@ -68,6 +68,10 @@ setup(
packages=find_packages(exclude=["test"]),
install_requires=install_requires,
include_package_data=True,
entry_points={"cubicweb.cubes": ["elasticsearch=cubicweb_elasticsearch",]},
entry_points={
"cubicweb.cubes": [
"elasticsearch=cubicweb_elasticsearch",
]
},
zip_safe=False,
)
......@@ -20,7 +20,12 @@ from cubicweb_elasticsearch.es import indexable_types, fulltext_indexable_rql
class ExportElasticSearchTC(testlib.AutoPopulateTest):
# ignore ComputedRelations
ignored_relations = set(
("narrower_concept", "hidden_label", "preferred_label", "alternative_label",)
(
"narrower_concept",
"hidden_label",
"preferred_label",
"alternative_label",
)
)
def setup_database(self):
......
......@@ -33,7 +33,12 @@ class IndexHookTC(testlib.CubicWebTC):
ce = cnx.create_entity
p = ce("Person", age=12, name=u"Jean")
cnx.commit()
self.assertEqual(MockQueue.es_operations, [("index", "Person", p.eid), ])
self.assertEqual(
MockQueue.es_operations,
[
("index", "Person", p.eid),
],
)
def test_esqueue_index_multiple(self):
"""ensure queue gets filled with "index" operations"""
......@@ -45,7 +50,10 @@ class IndexHookTC(testlib.CubicWebTC):
cnx.commit()
self.assertCountEqual(
MockQueue.es_operations,
[("index", "Person", p.eid), ("index", "Person", p2.eid), ],
[
("index", "Person", p.eid),
("index", "Person", p2.eid),
],
)
def test_esqueue_delete(self):
......@@ -61,7 +69,10 @@ class IndexHookTC(testlib.CubicWebTC):
cnx.commit()
self.assertCountEqual(
MockQueue.es_operations,
[("delete", "Person", p.eid), ("delete", "Person", p2.eid), ],
[
("delete", "Person", p.eid),
("delete", "Person", p2.eid),
],
)
......
......@@ -31,7 +31,7 @@ class IFullTextIndexSerializableTC(testlib.CubicWebTC):
@patch("elasticsearch.client.Elasticsearch.index")
def test_index_entity(self, index, exists, create):
"""Only update indexable attributes while call entity.complete()
on IFullTextIndexSerializable.serialze()
on IFullTextIndexSerializable.serialze()
"""
with self.admin_access.repo_cnx() as cnx:
with self.temporary_appobjects(BlogFTIAdapter, BlogEntryFTIAdapter):
......
......@@ -57,7 +57,7 @@ basepython = python3
skip_install = true
deps =
black >= 19.10b0
commands = black --target py36 .
commands = black .
[testenv:pypi-publish]
basepython = python3
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment