forked from pool/python-HyperKitty
35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
|
|
From 0e86f9cc40bf05cb819087f1fb0ee56f43968e1b Mon Sep 17 00:00:00 2001
|
||
|
|
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
|
||
|
|
Date: Thu, 6 Oct 2022 14:01:54 +0200
|
||
|
|
Subject: [PATCH] Make it compatible with elasticsearch 8.0.0
|
||
|
|
|
||
|
|
---
|
||
|
|
hyperkitty/tests/views/test_search.py | 10 +++++++++-
|
||
|
|
tox.ini | 2 +-
|
||
|
|
2 files changed, 10 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/hyperkitty/tests/views/test_search.py b/hyperkitty/tests/views/test_search.py
|
||
|
|
index ad0e9632..cad76fe6 100644
|
||
|
|
--- a/hyperkitty/tests/views/test_search.py
|
||
|
|
+++ b/hyperkitty/tests/views/test_search.py
|
||
|
|
@@ -211,10 +211,18 @@ class SearchViewsTestCase(SearchEnabledTestCase):
|
||
|
|
|
||
|
|
# For elasticsearch backend
|
||
|
|
from elasticsearch import RequestError
|
||
|
|
+ from elasticsearch import VERSION
|
||
|
|
+ mayor, _minor, _p = VERSION
|
||
|
|
+
|
||
|
|
+ search_error = "dummy parsing failure"
|
||
|
|
+ if mayor > 7:
|
||
|
|
+ class ElasticError:
|
||
|
|
+ status = search_error
|
||
|
|
+ search_error = ElasticError
|
||
|
|
|
||
|
|
class CrashingIterator(list):
|
||
|
|
def __len__(self):
|
||
|
|
- raise RequestError(400, "dummy parsing failure", {})
|
||
|
|
+ raise RequestError(400, search_error, {})
|
||
|
|
query = Mock()
|
||
|
|
|
||
|
|
with self.settings(HAYSTACK_CONNECTIONS={
|