Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
change percolator id convention
Browse files Browse the repository at this point in the history
  • Loading branch information
camsom committed Jun 17, 2015
1 parent 20414c0 commit 8512e38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bulbs/__init__.py
@@ -1 +1 @@
__version__ = "0.5.13"
__version__ = "0.5.14"
2 changes: 1 addition & 1 deletion bulbs/sections/models.py
Expand Up @@ -76,7 +76,7 @@ def get_content(self):

@property
def es_id(self):
return "{}.{}".format(self.slug, self.id)
return "section.{}".format(self.id)

@property
def contents(self):
Expand Down
14 changes: 7 additions & 7 deletions tests/sections/test_sections_es.py
Expand Up @@ -12,7 +12,7 @@ def setUp(self):

def test_es_id(self):
section = Section.objects.create(name='Politics', id=666)
assert section.es_id == "politics.666"
assert section.es_id == "section.666"

def test_save_percolator(self):
politics_condition = {
Expand All @@ -36,7 +36,7 @@ def test_save_percolator(self):
response = self.es.get(
index=Content.search_objects.mapping.index,
doc_type=".percolator",
id="politics.777",
id="section.777",
)
assert response["_source"]["query"] == section.get_content().to_dict()["query"]

Expand All @@ -62,7 +62,7 @@ def test_save_percolator(self):
response = self.es.get(
index=Content.search_objects.mapping.index,
doc_type=".percolator",
id="politics.777"
id="section.777"
)
assert response["_source"]["query"] == section.get_content().to_dict()["query"]

Expand All @@ -71,7 +71,7 @@ def test_delete_percolator(self):
self.es.index(
index=Content.search_objects.mapping.index,
doc_type=".percolator",
id="business.999",
id="section.999",
body={
"query": {
"filtered": {
Expand All @@ -85,18 +85,18 @@ def test_delete_percolator(self):
response = self.es.get(
index=Content.search_objects.mapping.index,
doc_type=".percolator",
id="business.999"
id="section.999"
)
assert isinstance(response, dict)
assert response["_id"] == "business.999"
assert response["_id"] == "section.999"

section.delete()

with self.assertRaises(TransportError):
response = self.es.get(
index=Content.search_objects.mapping.index,
doc_type=".percolator",
id="business.999"
id="section.999"
)


0 comments on commit 8512e38

Please sign in to comment.