diff --git a/rocketchat_API/APISections/settings.py b/rocketchat_API/APISections/settings.py index 78413a9..7635361 100644 --- a/rocketchat_API/APISections/settings.py +++ b/rocketchat_API/APISections/settings.py @@ -18,6 +18,14 @@ def settings_public(self, **kwargs): """List all private settings.""" return self.call_api_get("settings.public", kwargs=kwargs) + def settings_oauth(self, **kwargs): + """List all OAuth services.""" + return self.call_api_get("settings.oauth", kwargs=kwargs) + + def settings_addcustomoauth(self, name, **kwargs): + """Add a new custom OAuth service with the provided name.""" + return self.call_api_post("settings.addCustomOAuth", name=name, kwargs=kwargs) + def service_configurations(self, **kwargs): """List all service configurations.""" return self.call_api_get("service.configurations", kwargs=kwargs) diff --git a/tests/test_settings.py b/tests/test_settings.py index d648013..b3f14aa 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -1,3 +1,6 @@ +import time + + def test_settings(logged_rocket): settings = logged_rocket.settings().json() assert settings.get("success") @@ -16,6 +19,20 @@ def test_settings_public(rocket): assert "settings" in settings_public +def test_settings_oauth(logged_rocket): + oauth_get = logged_rocket.settings_oauth().json() + assert oauth_get.get("success") + assert not oauth_get.get("services") + oauth_set = logged_rocket.settings_addcustomoauth("Test").json() + assert oauth_set.get("success") + oauth_set = logged_rocket.settings_update("Accounts_OAuth_Custom-Test", True).json() + time.sleep(3) + assert oauth_set.get("success") + oauth_get = logged_rocket.settings_oauth().json() + assert oauth_get.get("success") + assert oauth_get.get("services")[0].get("service") == "test" + + def test_service_configurations(rocket): service_configurations = rocket.service_configurations().json() assert service_configurations.get("success")