mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 11:43:13 +00:00
add mocked invite user and remove users.
Maybe this shoud be a integration test too.
This commit is contained in:
parent
0594f24f8b
commit
368482fd11
2 changed files with 20 additions and 1 deletions
|
@ -162,12 +162,12 @@ def empty_response(mocker):
|
|||
response = mocker.MagicMock(status_code=200, text='<xml><child></child></xml>')
|
||||
return response
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def patched_http_call(mocker):
|
||||
return callable_http_patch(mocker)
|
||||
|
||||
|
||||
|
||||
# ---------------------------------
|
||||
# Utility Functions
|
||||
# ---------------------------------
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
from plexapi.exceptions import BadRequest
|
||||
from . import conftest as utils
|
||||
|
||||
|
||||
def test_myplex_accounts(account, plex):
|
||||
|
@ -114,3 +115,21 @@ def test_myplex_optout(account):
|
|||
|
||||
assert not all(enabled())
|
||||
|
||||
|
||||
def test_myplex_inviteFriend_remove(account, plex, mocker):
|
||||
inv_user = 'hellowlol'
|
||||
vid_filter = {'contentRating': ['G'], 'label': ['foo']}
|
||||
secs = plex.library.sections()
|
||||
|
||||
ids = account._getSectionIds(plex.machineIdentifier, secs)
|
||||
with mocker.patch.object(account, '_getSectionIds', return_value=ids):
|
||||
with utils.callable_http_patch(mocker):
|
||||
|
||||
account.inviteFriend(inv_user, plex, secs, allowSync=True, allowCameraUpload=True,
|
||||
allowChannels=False, filterMovies=vid_filter, filterTelevision=vid_filter,
|
||||
filterMusic={'label': ['foo']})
|
||||
|
||||
assert inv_user not in [u.title for u in account.users()]
|
||||
|
||||
with utils.callable_http_patch(mock):
|
||||
account.removeFriend(inv_user)
|
||||
|
|
Loading…
Reference in a new issue