Skip to content

Commit

Permalink
Sort praw.models.reddit.live.LiveContributorRelationship.update argum…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
LilSpazJoekp committed Jan 6, 2022
1 parent 060cd06 commit 58f39b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions praw/models/reddit/live.py
Expand Up @@ -177,9 +177,11 @@ def remove_invite(self, redditor: Union[str, "praw.models.Redditor"]):
url = API_PATH["live_remove_invite"].format(id=self.thread.id)
self.thread._reddit.post(url, data=data)

@_deprecate_args("redditor", "permissions")
def update(
self,
redditor: Union[str, "praw.models.Redditor"],
*,
permissions: Optional[List[str]] = None,
):
"""Update the contributor permissions for ``redditor``.
Expand All @@ -202,13 +204,13 @@ def update(
.. code-block:: python
thread.contributor.update("spez", ["access", "edit"])
thread.contributor.update("spez", permissions=["access", "edit"])
To remove all permissions from the contributor, try:
.. code-block:: python
subreddit.moderator.update("spez", [])
subreddit.moderator.update("spez", permissions=[])
"""
url = API_PATH["live_update_perms"].format(id=self.thread.id)
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/models/reddit/test_live.py
Expand Up @@ -164,19 +164,19 @@ def test_update__empty_list(self):
self.reddit.read_only = False
thread = LiveThread(self.reddit, "ydwwxneu7vsa")
with self.use_cassette():
thread.contributor.update("nmtake", [])
thread.contributor.update("nmtake", permissions=[])

def test_update__limited(self):
self.reddit.read_only = False
thread = LiveThread(self.reddit, "ydwwxneu7vsa")
with self.use_cassette():
thread.contributor.update("nmtake", ["manage", "edit"])
thread.contributor.update("nmtake", permissions=["manage", "edit"])

def test_update__none(self):
self.reddit.read_only = False
thread = LiveThread(self.reddit, "ydwwxneu7vsa")
with self.use_cassette():
thread.contributor.update("nmtake", None)
thread.contributor.update("nmtake", permissions=None)

def test_update_invite__empty_list(self):
self.reddit.read_only = False
Expand Down

0 comments on commit 58f39b5

Please sign in to comment.