def test_recently_added(): responses.add( responses.GET, 'http://mock:32400/library/recentlyAdded', body=read('fixtures/library/recently_added.xml'), status=200, content_type='application/xml' ) container = Plex['library'].recently_added() assert container is not None items = list(container) assert len(items) == 3 # Validate 'movie' assert items[0].type == 'movie' assert items[0].title == "TRON: Legacy" assert items[0].year == 2010 assert items[0].director.tag == "Joseph Kosinski" assert items[0].country.tag == "USA" assert [genre.tag for genre in items[0].genres] == [ "Action", "Adventure" ] assert [writer.tag for writer in items[0].writers] == [ "Adam Horowitz", "Richard Jefferies" ] assert [role.tag for role in items[0].roles] == [ "Garrett Hedlund", "Jeff Bridges", "Olivia Wilde" ] # Validate 'season' assert items[1].type == 'season' assert items[1].title == "Specials" assert items[1].index == 0 assert items[1].show.title == "Gold Rush" assert items[1].show.index == 1 # Validate 'album' assert items[2].type == 'album' assert items[2].title == "Angel Milk" assert items[2].index == 1 assert items[2].artist.title == six.u('T\xe9l\xe9popmusik') assert [genre.tag for genre in items[2].genres] == [ "Electronic", "Electronica" ]
def test_detail(): responses.add( responses.GET, 'http://mock:32400', body=read('fixtures/detail_malformed.xml'), status=200, content_type='application/xml' ) detail = Plex.detail() if PARSER == 'etree.HTMLParser': assert detail is not None assert detail.platform_version == six.u('6.2 (Build 9200)\xff\xff') else: assert detail is None
def test_detail(): responses.add(responses.GET, 'http://mock:32400', body=read('fixtures/detail_malformed.xml'), status=200, content_type='application/xml') detail = Plex.detail() if PARSER == 'etree.HTMLParser': assert detail is not None assert detail.platform_version == six.u('6.2 (Build 9200)\xff\xff') else: assert detail is None
def test_recently_added(): responses.add(responses.GET, 'http://mock:32400/library/recentlyAdded', body=read('fixtures/library/recently_added.xml'), status=200, content_type='application/xml') container = Plex['library'].recently_added() assert container is not None items = list(container) assert len(items) == 3 # Validate 'movie' assert items[0].type == 'movie' assert items[0].title == "TRON: Legacy" assert items[0].year == 2010 assert items[0].director.tag == "Joseph Kosinski" assert items[0].country.tag == "USA" assert [genre.tag for genre in items[0].genres] == ["Action", "Adventure"] assert [writer.tag for writer in items[0].writers ] == ["Adam Horowitz", "Richard Jefferies"] assert [role.tag for role in items[0].roles ] == ["Garrett Hedlund", "Jeff Bridges", "Olivia Wilde"] # Validate 'season' assert items[1].type == 'season' assert items[1].title == "Specials" assert items[1].index == 0 assert items[1].show.title == "Gold Rush" assert items[1].show.index == 1 # Validate 'album' assert items[2].type == 'album' assert items[2].title == "Angel Milk" assert items[2].index == 1 assert items[2].artist.title == six.u('T\xe9l\xe9popmusik') assert [genre.tag for genre in items[2].genres] == ["Electronic", "Electronica"]
def test_sessions(): responses.add( responses.GET, 'http://mock:32400/status/sessions', body=read('fixtures/status/sessions.xml'), status=200, content_type='application/xml' ) container = Plex['status'].sessions() assert container is not None items = list(container) assert len(items) == 3 # Validate 'episode' assert items[0].title == "Blind Date" assert items[0].type == 'episode' assert items[0].show.title == "30 Rock" assert items[0].session.key == 3 assert items[2].session.player.title == "One" assert items[2].session.user.title == "someone" # Validate 'movie' assert items[1].title == "The Hobbit The Desolation of Smaug" assert items[1].type == 'movie' assert items[1].session.key == 5 assert items[2].session.player.title == "One" assert items[2].session.user.title == "someone" # Validate 'track' assert items[2].title == "Don't look back" assert items[2].type == 'track' assert items[2].album.title == "Angel Milk" assert items[2].artist.title == six.u('T\xe9l\xe9popmusik') assert items[2].session.key == 4 assert items[2].session.player.title == "One" assert items[2].session.user.title == "someone"
def test_sessions(): responses.add(responses.GET, 'http://mock:32400/status/sessions', body=read('fixtures/status/sessions.xml'), status=200, content_type='application/xml') container = Plex['status'].sessions() assert container is not None items = list(container) assert len(items) == 3 # Validate 'episode' assert items[0].title == "Blind Date" assert items[0].type == 'episode' assert items[0].show.title == "30 Rock" assert items[0].session.key == 3 assert items[2].session.player.title == "One" assert items[2].session.user.title == "someone" # Validate 'movie' assert items[1].title == "The Hobbit The Desolation of Smaug" assert items[1].type == 'movie' assert items[1].session.key == 5 assert items[2].session.player.title == "One" assert items[2].session.user.title == "someone" # Validate 'track' assert items[2].title == "Don't look back" assert items[2].type == 'track' assert items[2].album.title == "Angel Milk" assert items[2].artist.title == six.u('T\xe9l\xe9popmusik') assert items[2].session.key == 4 assert items[2].session.player.title == "One" assert items[2].session.user.title == "someone"