-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: don't hardcode client class name.
Signed-off-by: dblock <[email protected]>
- Loading branch information
Showing
4 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# 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 unittest import TestCase | ||
|
||
from opensearchpy._async.client import AsyncOpenSearch | ||
|
||
|
||
class TestPluginsClient(TestCase): | ||
async def test_plugins_client(self): | ||
with self.assertWarns(Warning) as w: | ||
client = AsyncOpenSearch() | ||
client.plugins.__init__(client) # double-init | ||
self.assertEqual( | ||
str(w.warnings[0].message), | ||
"Cannot load `alerting` directly to AsyncOpenSearch as it already exists. Use `AsyncOpenSearch.plugin.alerting` instead.", | ||
) |
24 changes: 24 additions & 0 deletions
24
test_opensearchpy/test_client/test_plugins/test_plugins_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# 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 opensearchpy.client import OpenSearch | ||
|
||
from ...test_cases import TestCase | ||
|
||
|
||
class TestPluginsClient(TestCase): | ||
def test_plugins_client(self): | ||
with self.assertWarns(Warning) as w: | ||
client = OpenSearch() | ||
client.plugins.__init__(client) # double-init | ||
self.assertEqual( | ||
str(w.warnings[0].message), | ||
"Cannot load `alerting` directly to OpenSearch as it already exists. Use `OpenSearch.plugin.alerting` instead.", | ||
) |