Skip to content

Commit a439f48

Browse files
committed
fix: assert sanitized
1 parent 1424a2a commit a439f48

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

runtests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ def main():
1414
TestRunner = get_runner(settings)
1515
test_runner = TestRunner(failfast=True)
1616
# kept here to run a single test
17-
# failures = test_runner.run_tests(
18-
# [
19-
# "tests.test_index.IndexTestCase.test_reindex_with_rules"
20-
# ]
21-
# )
22-
failures = test_runner.run_tests(["tests"])
17+
failures = test_runner.run_tests(
18+
[
19+
"tests.test_index.IndexTestCase"
20+
]
21+
)
22+
# failures = test_runner.run_tests(["tests"])
2323
sys.exit(bool(failures))
2424

2525

tests/test_index.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
from .models import User, Website, Example
1111

1212

13+
def sanitize(hit):
14+
if "_highlightResult" in hit:
15+
hit.pop("_highlightResult")
16+
return hit
17+
18+
1319
class IndexTestCase(TestCase):
1420
def setUp(self):
1521
self.client = algolia_engine.client
@@ -320,7 +326,7 @@ class WebsiteIndex(AlgoliaIndex):
320326
synonyms = []
321327
self.client.browse_synonyms(
322328
self.index.index_name,
323-
lambda _resp: synonyms.extend([_hit.to_dict() for _hit in _resp.hits]),
329+
lambda _resp: synonyms.extend([sanitize(_hit.to_dict()) for _hit in _resp.hits]),
324330
)
325331
self.assertEqual(len(synonyms), 1, "There should only be one synonym")
326332
self.assertIn(

0 commit comments

Comments
 (0)