0caacf870c
* Added Tests for Notification and Search Pipeline.ml Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> * Add back the lines of comment in indices.py during resolving merge conflict. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> * Fix notification plugin tests, from async def to def. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> * Fix test errors. Rename function names and rewrite assertion tests. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> * Fix formatting errors. Added typings to CONTENT. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> --------- Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# The OpenSearch Contributors require contributions made to
|
|
# this file be licensed under the Apache-2.0 license or a
|
|
# compatible open source license.
|
|
#
|
|
# Modifications Copyright OpenSearch Contributors. See
|
|
# GitHub history for details.
|
|
|
|
from test_opensearchpy.test_cases import OpenSearchTestCase
|
|
|
|
|
|
class TestSearchPipeline(OpenSearchTestCase):
|
|
def test_create_search_pipeline(self) -> None:
|
|
body = {
|
|
"request_processors": [
|
|
{
|
|
"filter_query": {
|
|
"tag": "tag1",
|
|
"description": "This processor returns only publicly visible documents",
|
|
"query": {"term": {"visibility": "public"}},
|
|
}
|
|
}
|
|
],
|
|
"response_processors": [
|
|
{"rename_field": {"field": "message", "target_field": "notification"}}
|
|
],
|
|
}
|
|
|
|
self.client.search_pipeline.put("my_pipeline", body)
|
|
self.assert_url_called("PUT", "/_search/pipeline/my_pipeline")
|
|
|
|
def test_get_search_pipeline(self) -> None:
|
|
self.client.search_pipeline.get("my_pipeline")
|
|
self.assert_url_called("GET", "/_search/pipeline/my_pipeline")
|