Skip to content

Commit

Permalink
add settings.oauth and settings.addcustomoauth methods, along with a …
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
sistason committed Oct 31, 2021
1 parent 9021e4d commit 9ca548a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rocketchat_API/APISections/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 17 additions & 0 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import time


def test_settings(logged_rocket):
settings = logged_rocket.settings().json()
assert settings.get("success")
Expand All @@ -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")
Expand Down

0 comments on commit 9ca548a

Please sign in to comment.