Updated APIs to match other clients and opensearch openapi spec (#502)

Signed-off-by: saimedhi <[email protected]>
This commit is contained in:
Sai Medhini Reddy Maryada
2023-09-26 12:46:18 -04:00
committed by GitHub
parent 69750e82d8
commit c6c7df5461
17 changed files with 856 additions and 197 deletions
@@ -164,3 +164,55 @@ class TestSecurityPlugin(TestCase):
# Try fetching the user
with self.assertRaises(NotFoundError):
response = self.client.security.get_user(self.USER_NAME)
def test_health_check(self):
response = self.client.security.health_check()
self.assertNotIn("errors", response)
self.assertEqual("UP", response.get("status"))
def test_health(self):
response = self.client.security.health()
self.assertNotIn("errors", response)
self.assertEqual("UP", response.get("status"))
AUDIT_CONFIG_SETTINGS = {
"enabled": True,
"audit": {
"ignore_users": [],
"ignore_requests": [],
"disabled_rest_categories": ["AUTHENTICATED", "GRANTED_PRIVILEGES"],
"disabled_transport_categories": ["AUTHENTICATED", "GRANTED_PRIVILEGES"],
"log_request_body": False,
"resolve_indices": False,
"resolve_bulk_requests": False,
"exclude_sensitive_headers": True,
"enable_transport": False,
"enable_rest": True,
},
"compliance": {
"enabled": True,
"write_log_diffs": False,
"read_watched_fields": {},
"read_ignore_users": [],
"write_watched_indices": [],
"write_ignore_users": [],
"read_metadata_only": True,
"write_metadata_only": True,
"external_config": False,
"internal_config": True,
},
}
def test_update_audit_config(self):
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):
response = self.client.security.update_audit_configuration(
body=self.AUDIT_CONFIG_SETTINGS
)
self.assertNotIn("errors", response)
self.assertEqual("OK", response.get("status"))