Merge .pyi type stubs inline (#563)
* Merged types into .py code. Signed-off-by: dblock <[email protected]> * Fix: nox -rs generate. Signed-off-by: dblock <[email protected]> * Updated CHANGELOG. Signed-off-by: dblock <[email protected]> * Use lowest common python version for lint. Signed-off-by: dblock <[email protected]> * Fix: don't typeshed. Signed-off-by: dblock <[email protected]> * Removed unneeded comment. Signed-off-by: dblock <[email protected]> * Simplify OPENSEARCH_URL. Signed-off-by: dblock <[email protected]> * Fix: positional ignore_status used as chunk_size. Signed-off-by: dblock <[email protected]> * Fix: parse version string. Signed-off-by: dblock <[email protected]> * Remove future annotations for Python 3.6. Signed-off-by: dblock <[email protected]> * Fix: types in documentation. Signed-off-by: dblock <[email protected]> * Improve CHANGELOG text. Signed-off-by: dblock <[email protected]> * Re-added missing separator. Signed-off-by: dblock <[email protected]> * Remove duplicate licenses. Signed-off-by: dblock <[email protected]> * Get rid of Optional[Any]. Signed-off-by: dblock <[email protected]> * Fix docs with AsyncOpenSearch. Signed-off-by: dblock <[email protected]> * Fix: undo comment. Signed-off-by: dblock <[email protected]> --------- Signed-off-by: dblock <[email protected]>
This commit is contained in:
@@ -12,41 +12,41 @@ from test_opensearchpy.test_cases import OpenSearchTestCase
|
||||
|
||||
|
||||
class TestAlerting(OpenSearchTestCase):
|
||||
def test_create_monitor(self):
|
||||
def test_create_monitor(self) -> None:
|
||||
# Test Post Method
|
||||
self.client.alerting.create_monitor({})
|
||||
self.assert_url_called("POST", "/_plugins/_alerting/monitors")
|
||||
|
||||
def test_run_monitor(self):
|
||||
def test_run_monitor(self) -> None:
|
||||
self.client.alerting.run_monitor("...")
|
||||
self.assert_url_called("POST", "/_plugins/_alerting/monitors/.../_execute")
|
||||
|
||||
def test_get_monitor(self):
|
||||
def test_get_monitor(self) -> None:
|
||||
# Test Get Method
|
||||
self.client.alerting.get_monitor("...")
|
||||
self.assert_url_called("GET", "/_plugins/_alerting/monitors/...")
|
||||
|
||||
def test_search_monitor(self):
|
||||
def test_search_monitor(self) -> None:
|
||||
# Test Search Method
|
||||
self.client.alerting.search_monitor({})
|
||||
self.assert_url_called("GET", "/_plugins/_alerting/monitors/_search")
|
||||
|
||||
def test_update_monitor(self):
|
||||
def test_update_monitor(self) -> None:
|
||||
# Test Update Method
|
||||
self.client.alerting.update_monitor("...")
|
||||
self.assert_url_called("PUT", "/_plugins/_alerting/monitors/...")
|
||||
|
||||
def test_delete_monitor(self):
|
||||
def test_delete_monitor(self) -> None:
|
||||
# Test Delete Method
|
||||
self.client.alerting.delete_monitor("...")
|
||||
self.assert_url_called("DELETE", "/_plugins/_alerting/monitors/...")
|
||||
|
||||
def test_create_destination(self):
|
||||
def test_create_destination(self) -> None:
|
||||
# Test Post Method
|
||||
self.client.alerting.create_destination({})
|
||||
self.assert_url_called("POST", "/_plugins/_alerting/destinations")
|
||||
|
||||
def test_get_destination(self):
|
||||
def test_get_destination(self) -> None:
|
||||
# Test Get Method
|
||||
|
||||
# Get a specific destination
|
||||
@@ -57,21 +57,21 @@ class TestAlerting(OpenSearchTestCase):
|
||||
self.client.alerting.get_destination()
|
||||
self.assert_url_called("GET", "/_plugins/_alerting/destinations")
|
||||
|
||||
def test_update_destination(self):
|
||||
def test_update_destination(self) -> None:
|
||||
# Test Update Method
|
||||
self.client.alerting.update_destination("...")
|
||||
self.assert_url_called("PUT", "/_plugins/_alerting/destinations/...")
|
||||
|
||||
def test_delete_destination(self):
|
||||
def test_delete_destination(self) -> None:
|
||||
# Test Delete Method
|
||||
self.client.alerting.delete_destination("...")
|
||||
self.assert_url_called("DELETE", "/_plugins/_alerting/destinations/...")
|
||||
|
||||
def test_get_alerts(self):
|
||||
def test_get_alerts(self) -> None:
|
||||
self.client.alerting.get_alerts()
|
||||
self.assert_url_called("GET", "/_plugins/_alerting/monitors/alerts")
|
||||
|
||||
def test_acknowledge_alerts(self):
|
||||
def test_acknowledge_alerts(self) -> None:
|
||||
self.client.alerting.acknowledge_alert("...")
|
||||
self.assert_url_called(
|
||||
"POST", "/_plugins/_alerting/monitors/.../_acknowledge/alerts"
|
||||
|
||||
@@ -12,11 +12,11 @@ from test_opensearchpy.test_cases import OpenSearchTestCase
|
||||
|
||||
|
||||
class TestIndexManagement(OpenSearchTestCase):
|
||||
def test_create_policy(self):
|
||||
def test_create_policy(self) -> None:
|
||||
self.client.index_management.put_policy("...")
|
||||
self.assert_url_called("PUT", "/_plugins/_ism/policies/...")
|
||||
|
||||
def test_update_policy(self):
|
||||
def test_update_policy(self) -> None:
|
||||
self.client.index_management.put_policy(
|
||||
"...", params={"if_seq_no": 7, "if_primary_term": 1}
|
||||
)
|
||||
@@ -25,33 +25,33 @@ class TestIndexManagement(OpenSearchTestCase):
|
||||
self.assert_url_called("PUT", "/_plugins/_ism/policies/..."),
|
||||
)
|
||||
|
||||
def test_add_policy(self):
|
||||
def test_add_policy(self) -> None:
|
||||
self.client.index_management.add_policy("...")
|
||||
self.assert_url_called("POST", "/_plugins/_ism/add/...")
|
||||
|
||||
def test_get_policy(self):
|
||||
def test_get_policy(self) -> None:
|
||||
self.client.index_management.get_policy("...")
|
||||
self.assert_url_called("GET", "/_plugins/_ism/policies/...")
|
||||
|
||||
def test_remove_policy_from_index(self):
|
||||
def test_remove_policy_from_index(self) -> None:
|
||||
self.client.index_management.remove_policy_from_index("...")
|
||||
self.assert_url_called("POST", "/_plugins/_ism/remove/...")
|
||||
|
||||
def test_change_policy(self):
|
||||
def test_change_policy(self) -> None:
|
||||
self.client.index_management.change_policy("...")
|
||||
self.assert_url_called("POST", "/_plugins/_ism/change_policy/...")
|
||||
|
||||
def test_retry(self):
|
||||
def test_retry(self) -> None:
|
||||
self.client.index_management.retry("...")
|
||||
self.assert_url_called("POST", "/_plugins/_ism/retry/...")
|
||||
|
||||
def test_explain_index(self):
|
||||
def test_explain_index(self) -> None:
|
||||
self.client.index_management.explain_index("...", show_policy=True)
|
||||
self.assertEqual(
|
||||
[({"show_policy": b"true"}, {}, None)],
|
||||
self.assert_url_called("GET", "/_plugins/_ism/explain/..."),
|
||||
)
|
||||
|
||||
def test_delete_policy(self):
|
||||
def test_delete_policy(self) -> None:
|
||||
self.client.index_management.delete_policy("...")
|
||||
self.assert_url_called("DELETE", "/_plugins/_ism/policies/...")
|
||||
|
||||
@@ -14,7 +14,7 @@ from ...test_cases import TestCase
|
||||
|
||||
|
||||
class TestPluginsClient(TestCase):
|
||||
def test_plugins_client(self):
|
||||
def test_plugins_client(self) -> None:
|
||||
with self.assertWarns(Warning) as w:
|
||||
client = OpenSearch()
|
||||
client.plugins.__init__(client) # double-init
|
||||
|
||||
Reference in New Issue
Block a user