cleaned up nzb download clients.

This commit is contained in:
kay.one
2013-08-17 16:27:18 -07:00
parent ed883fd014
commit b6ca43f734
11 changed files with 77 additions and 171 deletions

View File

@@ -61,14 +61,14 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
.Returns("{ \"status\": true }");
Subject.DownloadNzb(_remoteEpisode).Should().BeTrue();
Subject.DownloadNzb(_remoteEpisode);
}
[Test]
public void add_by_url_should_detect_and_handle_sab_errors()
{
WithFailResponse();
Assert.Throws<ApplicationException>(() => Subject.DownloadNzb(_remoteEpisode).Should().BeFalse());
Assert.Throws<ApplicationException>(() => Subject.DownloadNzb(_remoteEpisode));
}
[Test]
@@ -197,13 +197,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
}
[Test]
public void should_return_false_when_WebException_is_thrown()
public void should_throw_when_WebException_is_thrown()
{
Mocker.GetMock<IHttpProvider>()
.Setup(s => s.DownloadString(It.IsAny<String>())).Throws(new WebException());
Subject.DownloadNzb(_remoteEpisode).Should().BeFalse();
ExceptionVerification.ExpectedErrors(1);
Assert.Throws<WebException>(() => Subject.DownloadNzb(_remoteEpisode));
}
[Test]
@@ -219,7 +218,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
.Returns("{ \"status\": true }");
Subject.DownloadNzb(_remoteEpisode).Should().BeTrue();
Subject.DownloadNzb(_remoteEpisode);
Mocker.GetMock<IHttpProvider>()
.Verify(v => v.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"), Times.Once());