Skip to content

Commit 05c2198

Browse files
authored
add test
add tests for creating and remove home users and inviting existing user to home and removing invite.
1 parent 654f25b commit 05c2198

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_myplex.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,27 @@ def test_myplex_updateFriend(account, plex, mocker, shared_username):
157157
filterTelevision=vid_filter, filterMusic={'label': ['foo']})
158158

159159

160+
def test_myplex_createExistingUser(account, plex, shared_username):
161+
user = account.user(shared_username)
162+
url = 'https://plex.tv/api/invites/requested/{}?friend=0&server=0&home=1'.format(user.id)
163+
164+
account.createExistingUser(user, plex)
165+
assert shared_username in [u.username for u in account.users() if u.home is True]
166+
# Remove Home invite
167+
account.query(url, account._session.delete)
168+
# Confirm user was removed from home and has returned to friend
169+
assert shared_username not in [u.username for u in plex.myPlexAccount().users() if u.home is True]
170+
assert shared_username in [u.username for u in plex.myPlexAccount().users() if u.home is False]
171+
172+
173+
def test_myplex_createHomeUser_remove(account, plex):
174+
homeuser = 'New Home User'
175+
account.createHomeUser(homeuser, plex)
176+
assert homeuser in [u.title for u in plex.myPlexAccount().users() if u.home is True]
177+
account.removeHomeUser(homeuser)
178+
assert homeuser not in [u.title for u in plex.myPlexAccount().users() if u.home is True]
179+
180+
160181
def test_myplex_plexpass_attributes(account_plexpass):
161182
assert account_plexpass.subscriptionActive
162183
assert account_plexpass.subscriptionStatus == 'Active'

0 commit comments

Comments
 (0)