mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Fixed: Plex server authentication
This commit is contained in:
@@ -33,79 +33,6 @@ namespace NzbDrone.Core.Test.NotificationTests
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetSectionKeys_should_return_single_section_key_when_only_one_show_section()
|
||||
{
|
||||
var response = "<MediaContainer size=\"1\" mediaTagPrefix=\"/system/bundle/media/flags/\" mediaTagVersion=\"1329809559\" title1=\"Plex Library\" identifier=\"com.plexapp.plugins.library\"><Directory refreshing=\"0\" key=\"5\" type=\"show\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory></MediaContainer>";
|
||||
Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response));
|
||||
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null))
|
||||
.Returns(stream);
|
||||
|
||||
var result = Mocker.Resolve<PlexService>().GetSectionKeys(new PlexServerSettings { Host = "localhost", Port = 32400 });
|
||||
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().Should().Be(5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetSectionKeys_should_return_single_section_key_when_only_one_show_section_with_other_sections()
|
||||
{
|
||||
|
||||
|
||||
var response = "<MediaContainer size=\"1\" mediaTagPrefix=\"/system/bundle/media/flags/\" mediaTagVersion=\"1329809559\" title1=\"Plex Library\" identifier=\"com.plexapp.plugins.library\"><Directory refreshing=\"0\" key=\"5\" type=\"show\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory><Directory refreshing=\"0\" key=\"7\" type=\"movie\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory></MediaContainer>";
|
||||
Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response));
|
||||
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null))
|
||||
.Returns(stream);
|
||||
|
||||
|
||||
var result = Mocker.Resolve<PlexService>().GetSectionKeys(new PlexServerSettings { Host = "localhost", Port = 32400 });
|
||||
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().Should().Be(5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetSectionKeys_should_return_multiple_section_keys_when_there_are_multiple_show_sections()
|
||||
{
|
||||
|
||||
|
||||
var response = "<MediaContainer size=\"1\" mediaTagPrefix=\"/system/bundle/media/flags/\" mediaTagVersion=\"1329809559\" title1=\"Plex Library\" identifier=\"com.plexapp.plugins.library\"><Directory refreshing=\"0\" key=\"5\" type=\"show\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory><Directory refreshing=\"0\" key=\"6\" type=\"show\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory></MediaContainer>";
|
||||
Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response));
|
||||
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null))
|
||||
.Returns(stream);
|
||||
|
||||
|
||||
var result = Mocker.Resolve<PlexService>().GetSectionKeys(new PlexServerSettings { Host = "localhost", Port = 32400 });
|
||||
|
||||
|
||||
result.Should().HaveCount(2);
|
||||
result.First().Should().Be(5);
|
||||
result.Last().Should().Be(6);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateSection_should_update_section()
|
||||
{
|
||||
|
||||
|
||||
var response = "";
|
||||
Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response));
|
||||
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadString("http://localhost:32400/library/sections/5/refresh"))
|
||||
.Returns(response);
|
||||
|
||||
|
||||
Mocker.Resolve<PlexService>().UpdateSection(new PlexServerSettings { Host = "localhost", Port = 32400 }, 5);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Notify_should_send_notification()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user