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:
@@ -36,15 +36,15 @@ class TestSecurityPlugin(TestCase):
|
||||
USER_NAME = "test-user"
|
||||
USER_CONTENT = {"password": "opensearchpy@123", "opendistro_security_roles": []}
|
||||
|
||||
def setUp(self):
|
||||
def setUp(self) -> None:
|
||||
self.client = get_test_client(verify_certs=False, http_auth=("admin", "admin"))
|
||||
add_connection("default", self.client)
|
||||
|
||||
def tearDown(self):
|
||||
def tearDown(self) -> None:
|
||||
if self.client:
|
||||
self.client.close()
|
||||
|
||||
def test_create_role(self):
|
||||
def test_create_role(self) -> None:
|
||||
# Test to create role
|
||||
response = self.client.security.create_role(
|
||||
self.ROLE_NAME, body=self.ROLE_CONTENT
|
||||
@@ -53,7 +53,7 @@ class TestSecurityPlugin(TestCase):
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertIn(response.get("status"), ["CREATED", "OK"])
|
||||
|
||||
def test_create_role_with_body_param_empty(self):
|
||||
def test_create_role_with_body_param_empty(self) -> None:
|
||||
try:
|
||||
self.client.security.create_role(self.ROLE_NAME, body="")
|
||||
except ValueError as error:
|
||||
@@ -61,7 +61,7 @@ class TestSecurityPlugin(TestCase):
|
||||
else:
|
||||
assert False
|
||||
|
||||
def test_get_role(self):
|
||||
def test_get_role(self) -> None:
|
||||
# Create a role
|
||||
self.test_create_role()
|
||||
|
||||
@@ -71,7 +71,7 @@ class TestSecurityPlugin(TestCase):
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertIn(self.ROLE_NAME, response)
|
||||
|
||||
def test_update_role(self):
|
||||
def test_update_role(self) -> None:
|
||||
# Create a role
|
||||
self.test_create_role()
|
||||
|
||||
@@ -84,7 +84,7 @@ class TestSecurityPlugin(TestCase):
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertEqual("OK", response.get("status"))
|
||||
|
||||
def test_delete_role(self):
|
||||
def test_delete_role(self) -> None:
|
||||
# Create a role
|
||||
self.test_create_role()
|
||||
|
||||
@@ -97,7 +97,7 @@ class TestSecurityPlugin(TestCase):
|
||||
with self.assertRaises(NotFoundError):
|
||||
response = self.client.security.get_role(self.ROLE_NAME)
|
||||
|
||||
def test_create_user(self):
|
||||
def test_create_user(self) -> None:
|
||||
# Test to create user
|
||||
response = self.client.security.create_user(
|
||||
self.USER_NAME, body=self.USER_CONTENT
|
||||
@@ -106,7 +106,7 @@ class TestSecurityPlugin(TestCase):
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertIn(response.get("status"), ["CREATED", "OK"])
|
||||
|
||||
def test_create_user_with_body_param_empty(self):
|
||||
def test_create_user_with_body_param_empty(self) -> None:
|
||||
try:
|
||||
self.client.security.create_user(self.USER_NAME, body="")
|
||||
except ValueError as error:
|
||||
@@ -129,7 +129,7 @@ class TestSecurityPlugin(TestCase):
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertIn(response.get("status"), ["CREATED", "OK"])
|
||||
|
||||
def test_get_user(self):
|
||||
def test_get_user(self) -> None:
|
||||
# Create a user
|
||||
self.test_create_user()
|
||||
|
||||
@@ -139,7 +139,7 @@ class TestSecurityPlugin(TestCase):
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertIn(self.USER_NAME, response)
|
||||
|
||||
def test_update_user(self):
|
||||
def test_update_user(self) -> None:
|
||||
# Create a user
|
||||
self.test_create_user()
|
||||
|
||||
@@ -152,7 +152,7 @@ class TestSecurityPlugin(TestCase):
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertEqual("OK", response.get("status"))
|
||||
|
||||
def test_delete_user(self):
|
||||
def test_delete_user(self) -> None:
|
||||
# Create a user
|
||||
self.test_create_user()
|
||||
|
||||
@@ -165,12 +165,12 @@ class TestSecurityPlugin(TestCase):
|
||||
with self.assertRaises(NotFoundError):
|
||||
response = self.client.security.get_user(self.USER_NAME)
|
||||
|
||||
def test_health_check(self):
|
||||
def test_health_check(self) -> None:
|
||||
response = self.client.security.health_check()
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertEqual("UP", response.get("status"))
|
||||
|
||||
def test_health(self):
|
||||
def test_health(self) -> None:
|
||||
response = self.client.security.health()
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertEqual("UP", response.get("status"))
|
||||
@@ -203,14 +203,14 @@ class TestSecurityPlugin(TestCase):
|
||||
},
|
||||
}
|
||||
|
||||
def test_update_audit_config(self):
|
||||
def test_update_audit_config(self) -> None:
|
||||
response = self.client.security.update_audit_config(
|
||||
body=self.AUDIT_CONFIG_SETTINGS
|
||||
)
|
||||
self.assertNotIn("errors", response)
|
||||
self.assertEqual("OK", response.get("status"))
|
||||
|
||||
def test_update_audit_configuration(self):
|
||||
def test_update_audit_configuration(self) -> None:
|
||||
response = self.client.security.update_audit_configuration(
|
||||
body=self.AUDIT_CONFIG_SETTINGS
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user