Skip to content

Commit

Permalink
Merge pull request #149 from BenjaminBoehm/feature/group_announcement
Browse files Browse the repository at this point in the history
Add method for groups.setAnnouncement
  • Loading branch information
jadolg authored Nov 17, 2021
2 parents a1f2a9d + e94a56e commit 8be9902
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rocketchat_API/APISections/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ def groups_rename(self, room_id, name, **kwargs):
"groups.rename", roomId=room_id, name=name, kwargs=kwargs
)

def groups_set_announcement(self, room_id, announcement, **kwargs):
"""Sets the announcement for the private group."""
return self.call_api_post(
"groups.setAnnouncement",
roomId=room_id,
announcement=announcement,
kwargs=kwargs,
)

def groups_set_description(self, room_id, description, **kwargs):
"""Sets the description for the private group."""
return self.call_api_post(
Expand Down
11 changes: 11 additions & 0 deletions tests/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ def test_groups_rename(logged_rocket):
assert groups_rename.get("group").get("name") == name2


def test_groups_set_announcement(logged_rocket, test_group_id):
announcement = str(uuid.uuid1())
groups_set_announcement = logged_rocket.groups_set_announcement(
test_group_id, announcement
).json()
assert groups_set_announcement.get("success")
assert (
groups_set_announcement.get("announcement") == announcement
), "Announcement does not match"


def test_groups_set_description(logged_rocket, test_group_id):
description = str(uuid.uuid1())
groups_set_description = logged_rocket.groups_set_description(
Expand Down

0 comments on commit 8be9902

Please sign in to comment.