Skip to content

Commit 368482f

Browse files
committed
add mocked invite user and remove users.
Maybe this shoud be a integration test too.
1 parent 0594f24 commit 368482f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ def empty_response(mocker):
162162
response = mocker.MagicMock(status_code=200, text='<xml><child></child></xml>')
163163
return response
164164

165+
165166
@pytest.fixture()
166167
def patched_http_call(mocker):
167168
return callable_http_patch(mocker)
168169

169170

170-
171171
# ---------------------------------
172172
# Utility Functions
173173
# ---------------------------------

tests/test_myplex.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import pytest
33
from plexapi.exceptions import BadRequest
4+
from . import conftest as utils
45

56

67
def test_myplex_accounts(account, plex):
@@ -114,3 +115,21 @@ def enabled():
114115

115116
assert not all(enabled())
116117

118+
119+
def test_myplex_inviteFriend_remove(account, plex, mocker):
120+
inv_user = 'hellowlol'
121+
vid_filter = {'contentRating': ['G'], 'label': ['foo']}
122+
secs = plex.library.sections()
123+
124+
ids = account._getSectionIds(plex.machineIdentifier, secs)
125+
with mocker.patch.object(account, '_getSectionIds', return_value=ids):
126+
with utils.callable_http_patch(mocker):
127+
128+
account.inviteFriend(inv_user, plex, secs, allowSync=True, allowCameraUpload=True,
129+
allowChannels=False, filterMovies=vid_filter, filterTelevision=vid_filter,
130+
filterMusic={'label': ['foo']})
131+
132+
assert inv_user not in [u.title for u in account.users()]
133+
134+
with utils.callable_http_patch(mock):
135+
account.removeFriend(inv_user)

0 commit comments

Comments
 (0)