Skip to content

Commit

Permalink
Update Plex Web URL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyWong16 committed Sep 26, 2021
1 parent 49ce2f9 commit 516c8ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/test_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_library_MovieSection_PlexWebURL_hub(plex, movies):
hubs = movies.hubs()
hub = next(iter(hubs), None)
assert hub is not None
url = hub.getWebURL()
url = hub.section().getWebURL(key=hub.key)
assert url.startswith('https://app.plex.tv/desktop')
assert plex.machineIdentifier in url
assert 'source=%s' % movies.key in url
Expand Down
21 changes: 15 additions & 6 deletions tests/test_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import re
import time
from urllib.parse import quote_plus

import pytest
from datetime import datetime
Expand Down Expand Up @@ -514,14 +515,22 @@ def test_server_transcode_sessions(plex, requests_mock):
assert utils.is_int(session.width, gte=852)


def test_server_PlaylistsPlexWebURL(plex):
tab = 'audio'
url = plex.getPlaylistsWebURL(tab=tab)
def test_server_PlexWebURL(plex):
url = plex.getWebURL()
assert url.startswith('https://app.plex.tv/desktop')
assert plex.machineIdentifier in url
assert 'source=playlists' in url
assert 'pivot=playlists.%s' % tab in url
assert quote_plus('/hubs') in url
assert 'pageType=hub' in url
# Test a different base
base = 'https://doesnotexist.com/plex'
url = plex.getPlaylistsWebURL(base=base)
url = plex.getWebURL(base=base)
assert url.startswith(base)


def test_server_PlexWebURL_playlists(plex):
tab = 'audio'
url = plex.getWebURL(playlistTab=tab)
assert url.startswith('https://app.plex.tv/desktop')
assert plex.machineIdentifier in url
assert 'source=playlists' in url
assert 'pivot=playlists.%s' % tab in url

0 comments on commit 516c8ed

Please sign in to comment.